Skip to content

Conversation

@ahocevar
Copy link
Member

@ahocevar ahocevar commented Aug 2, 2017

When working with MVT tiles, we can determine the tilePixelRatio from metadata in the tile. This pull request changes things so users no longer need to configure the source with a tilePixelRatio when ol.format.MVT is used to parse tiles.

@ahocevar ahocevar force-pushed the mvt-tilepixelratio branch from 3be07af to 95c463c Compare August 2, 2017 17:24
@ahocevar
Copy link
Member Author

ahocevar commented Aug 2, 2017

Tests added.

@ahocevar ahocevar force-pushed the mvt-tilepixelratio branch from 95c463c to 04cef53 Compare August 2, 2017 18:10
@ahocevar ahocevar force-pushed the mvt-tilepixelratio branch from 04cef53 to b3be7e7 Compare August 2, 2017 18:11
@ahocevar ahocevar force-pushed the mvt-tilepixelratio branch from 845b3f7 to d4d371a Compare August 2, 2017 22:20
Copy link
Member

@tschaub tschaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see the extra parameter removed in the examples.

* @return {number} Tile pixel ratio.
*/
ol.source.Tile.prototype.getTilePixelRatio = function(opt_pixelRatio) {
ol.source.Tile.prototype.getTilePixelRatio = function(pixelRatio) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change required?

Copy link
Member Author

@ahocevar ahocevar Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not strictly required, but makes things consistent again. The vector tile renderer introduced a 2nd mode of getTilePixelRatio(): when called without a pixel ratio, it was meant to return the source's tilePixelRatio, which was the 8 used in the vector tile examples.

Originally, when called with a pixel ratio, the function was meant to return the tilePixelRatio that best matches the provided pixelRatio. This is usually the provided pixelRatio for vector tiles and WMS servers that have a dpi param, or 1 for image tile sources that have no HiDPI support.

Now we're back to that original meaning.

@ahocevar ahocevar merged commit 83c3575 into openlayers:master Aug 3, 2017
@ahocevar ahocevar deleted the mvt-tilepixelratio branch August 3, 2017 06:47
fredj added a commit to fredj/openlayers that referenced this pull request Mar 18, 2019
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.

2 participants