-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow changing parameters/dimensions for WMS and WMTS #994
Conversation
@@ -100,6 +107,25 @@ goog.inherits(ol.source.TiledWMS, ol.source.ImageTileSource); | |||
/** | |||
* @inheritDoc | |||
*/ | |||
ol.source.TiledWMS.prototype.getKeyZXY = function(z, x, y) { | |||
return goog.object.getValues(this.params_).join('/') + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if the same cache key could be generated for different params (which would have the same value) if we only include the params values (not the keys) to build the cache key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The computation of goog.object.getValues(this.params_).join('/')
can also be done and cached when this.params_
changes. This'll save some time and garbage.
4c708ba looks good. |
It looks very good, thanks Eric. On 9 September 2013 14:26, Éric Lemoine notifications@github.com wrote:
|
Wouldn't setParams be more consistent naming? |
setParams would suggest that it replace the whole params object, but it is not the case here. |
User/custom params are known as dimensions in WMTS. And with WMTS REST dimensions are not sent as GET parameters. Dimension is a more general term that applies to both REST and KVP. |
This uses more robust ZXY coordinate keys, and caches the key to avoid creating garbage each time getKeyZXY is called.
If we had setParams instead of updateParams the user would have to do something like this to add or update parameters:
(This assumes jQuery.) We've considered that I'm going to merge this but I'm happy to re-discuss the API, and change it if people think that a getParams/setParams, or something, would be better. |
Allow changing parameters/dimensions for WMS and WMTS
This PR allows to dynamically change parameters and dimensions of WMS and WMTS sources. This is a collaborative work with @oterral and @twpayne.
Commit 7779ca6, which adds getDimensions and updateDimensions ol.source.WMTS, is a also a refactoring of the ol.source.WMTS code.