diff --git a/src/ol/source/tilearcgisrest.js b/src/ol/source/tilearcgisrest.js index 06ad9da371..1004d00264 100644 --- a/src/ol/source/tilearcgisrest.js +++ b/src/ol/source/tilearcgisrest.js @@ -55,10 +55,25 @@ ol.source.TileArcGISRest = function(opt_options) { */ this.tmpExtent_ = ol.extent.createEmpty(); + this.setKey(this.getKeyForParams_()); }; ol.inherits(ol.source.TileArcGISRest, ol.source.TileImage); +/** + * @private + * @return {string} The key for the current params. + */ +ol.source.TileArcGISRest.prototype.getKeyForParams_ = function() { + var i = 0; + var res = []; + for (var key in this.params_) { + res[i++] = key + '-' + this.params_[key]; + } + return res.join('/'); +}; + + /** * Get the user-provided params, i.e. those passed to the constructor through * the "params" option, and possibly updated using the updateParams method. @@ -168,5 +183,5 @@ ol.source.TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pi */ ol.source.TileArcGISRest.prototype.updateParams = function(params) { ol.obj.assign(this.params_, params); - this.changed(); + this.setKey(this.getKeyForParams_()); };