Skip to content

Commit

Permalink
fix #574, use request for export requests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickarlt committed Jul 8, 2015
1 parent 7bd213e commit c62ef49
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions spec/Layers/ImageMapLayerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ describe('L.esri.Layers.ImageMapLayer', function () {
});

it('should be able to request an image directly from the export service', function(){
layer = L.esri.imageMapLayer(url);
layer = L.esri.imageMapLayer(url, {
f: 'image'
});
var spy = sinon.spy(layer, '_renderImage');
layer.addTo(map);
expect(spy.getCall(0).args[0]).to.match(new RegExp(/http:\/\/services.arcgis.com\/mock\/arcgis\/rest\/services\/MockImageService\/ImageServer\/exportImage\?bbox=-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+&size=500%2C500&format=jpgpng&transparent=true&bboxSR=3857&imageSR=3857&f=image/));
Expand All @@ -438,4 +440,4 @@ describe('L.esri.Layers.ImageMapLayer', function () {
server.respond();
});

});
});
4 changes: 2 additions & 2 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({

_requestExport: function (params, bounds) {
if(this.options.f === 'json'){
this._service.get('export', params, function(error, response){
this._service.request('export', params, function(error, response){
this._renderImage(response.href, bounds);
}, this);
} else {
Expand All @@ -166,4 +166,4 @@ EsriLeaflet.Layers.dynamicMapLayer = function(url, options){

EsriLeaflet.dynamicMapLayer = function(url, options){
return new EsriLeaflet.Layers.DynamicMapLayer(url, options);
};
};
5 changes: 3 additions & 2 deletions src/Layers/ImageMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({
options: {
updateInterval: 150,
format: 'jpgpng',
transparent: true
transparent: true,
f: 'json'
},

query: function(){
Expand Down Expand Up @@ -173,7 +174,7 @@ EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({

_requestExport: function (params, bounds) {
if (this.options.f === 'json') {
this._service.get('exportImage', params, function(error, response){
this._service.request('exportImage', params, function(error, response){
this._renderImage(response.href, bounds);
}, this);
} else {
Expand Down

0 comments on commit c62ef49

Please sign in to comment.