Skip to content
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

Merged
merged 8 commits into from
Sep 10, 2013
Merged

Allow changing parameters/dimensions for WMS and WMTS #994

merged 8 commits into from
Sep 10, 2013

Conversation

elemoine
Copy link
Member

@elemoine elemoine commented Sep 9, 2013

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.

@@ -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('/') +
Copy link
Member

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?

Copy link
Contributor

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.

@elemoine
Copy link
Member Author

elemoine commented Sep 9, 2013

Thanks for the comments @bbinet and @twpayne. Does 4c708ba work for you?

@twpayne
Copy link
Contributor

twpayne commented Sep 9, 2013

4c708ba looks good.

@bbinet
Copy link
Member

bbinet commented Sep 9, 2013

It looks very good, thanks Eric.

On 9 September 2013 14:26, Éric Lemoine notifications@github.com wrote:

Thanks for the comments @bbinet https://github.com/bbinet and @twpaynehttps://github.com/twpayne.
Does 4c708ba 4c708ba work for
you?


Reply to this email directly or view it on GitHubhttps://github.com//pull/994#issuecomment-24068992
.

@probins
Copy link
Contributor

probins commented Sep 9, 2013

Wouldn't setParams be more consistent naming?

@bbinet
Copy link
Member

bbinet commented Sep 9, 2013

setParams would suggest that it replace the whole params object, but it is not the case here.

@elemoine
Copy link
Member Author

elemoine commented Sep 9, 2013

Wouldn't setParams be more consistent naming?

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.

@elemoine
Copy link
Member Author

If we had setParams instead of updateParams the user would have to do something like this to add or update parameters:

source.setParams($.extend({}, this.getParams(), {foo: 'foo', bar: 'bar}));

(This assumes jQuery.)

We've considered that updateParams makes a more convenient API.

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.

elemoine pushed a commit that referenced this pull request Sep 10, 2013
Allow changing parameters/dimensions for WMS and WMTS
@elemoine elemoine merged commit b92f5ef into openlayers:master Sep 10, 2013
@elemoine elemoine deleted the update-params branch April 27, 2015 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants