diff --git a/.gitignore b/.gitignore
index bd1919c2a..1dcdf6fba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,9 @@ debug/*.js
debug/*.json
debug/archive/
!debug/sample.html
+!debug/sample-dynamic-map-layer.html
+!debug/sample-dynamic-map-layer-server-auth.html
+!debug/sample-image-map-layer.html
# Docs Build
site/build
diff --git a/debug/sample-dynamic-map-layer-server-auth.html b/debug/sample-dynamic-map-layer-server-auth.html
new file mode 100644
index 000000000..4e6fcb9de
--- /dev/null
+++ b/debug/sample-dynamic-map-layer-server-auth.html
@@ -0,0 +1,103 @@
+
+
+
+
+
+ Esri Leaflet Debugging Sample
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/debug/sample-dynamic-map-layer.html b/debug/sample-dynamic-map-layer.html
new file mode 100644
index 000000000..48431d59c
--- /dev/null
+++ b/debug/sample-dynamic-map-layer.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+ Esri Leaflet Debugging Sample
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/debug/sample-image-map-layer.html b/debug/sample-image-map-layer.html
new file mode 100644
index 000000000..a5e815a90
--- /dev/null
+++ b/debug/sample-image-map-layer.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+ Esri Leaflet Debugging Sample
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Layers/DynamicMapLayer.js b/src/Layers/DynamicMapLayer.js
index 5b82132c4..5f909f4a5 100644
--- a/src/Layers/DynamicMapLayer.js
+++ b/src/Layers/DynamicMapLayer.js
@@ -20,10 +20,6 @@ export var DynamicMapLayer = RasterLayer.extend({
this.service = mapService(options);
this.service.addEventParent(this);
- if ((options.proxy || options.token) && options.f !== 'json') {
- options.f = 'json';
- }
-
Util.setOptions(this, options);
},
@@ -179,12 +175,16 @@ export var DynamicMapLayer = RasterLayer.extend({
this.service.request('export', params, function (error, response) {
if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire
- if (this.options.token && response.href) {
- response.href += ('?token=' + this.options.token);
+ if (params.token && response.href) {
+ // append token
+ response.href += ('?token=' + params.token);
}
- if (this.options.proxy && response.href) {
- response.href = this.options.proxy + '?' + response.href;
+
+ if (params.proxy && response.href) {
+ // prepend proxy
+ response.href = params.proxy + '?' + response.href;
}
+
if (response.href) {
this._renderImage(response.href, bounds);
} else {
@@ -192,8 +192,18 @@ export var DynamicMapLayer = RasterLayer.extend({
}
}, this);
} else {
+ // if not 'json', then 'image' is the only other valid value for params.f
+ // (this.options.f should be equal to 'image' if the default 'json' value was not used)
params.f = 'image';
- this._renderImage(this.options.url + 'export' + Util.getParamString(params), bounds);
+
+ var url = this.options.url + 'export' + Util.getParamString(params);
+
+ if (params.proxy) {
+ // prepend proxy
+ url = params.proxy + '?' + url;
+ }
+
+ this._renderImage(url, bounds);
}
}
});
diff --git a/src/Layers/ImageMapLayer.js b/src/Layers/ImageMapLayer.js
index 0f4846964..8791ca7b6 100644
--- a/src/Layers/ImageMapLayer.js
+++ b/src/Layers/ImageMapLayer.js
@@ -165,6 +165,10 @@ export var ImageMapLayer = RasterLayer.extend({
params.token = this.service.options.token;
}
+ if (this.options.proxy) {
+ params.proxy = this.options.proxy;
+ }
+
if (this.options.renderingRule) {
params.renderingRule = JSON.stringify(this.options.renderingRule);
}
@@ -180,17 +184,32 @@ export var ImageMapLayer = RasterLayer.extend({
if (this.options.f === 'json') {
this.service.request('exportImage', params, function (error, response) {
if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire
- if (this.options.token) {
- response.href += ('?token=' + this.options.token);
+
+ if (params.token) {
+ // append token
+ response.href += ('?token=' + params.token);
}
- if (this.options.proxy) {
- response.href = this.options.proxy + '?' + response.href;
+
+ if (params.proxy) {
+ // prepend proxy
+ response.href = params.proxy + '?' + response.href;
}
+
this._renderImage(response.href, bounds);
}, this);
} else {
+ // if not 'json', then 'image' is the only other valid value for params.f
+ // (this.options.f should be equal to 'image' if the optional 'json' value was not used)
params.f = 'image';
- this._renderImage(this.options.url + 'exportImage' + Util.getParamString(params), bounds);
+
+ var url = this.options.url + 'exportImage' + Util.getParamString(params);
+
+ if (params.proxy) {
+ // prepend proxy
+ url = params.proxy + '?' + url;
+ }
+
+ this._renderImage(url, bounds);
}
}
});