-
Notifications
You must be signed in to change notification settings - Fork 26
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 specifying a custom rendering pixel size #139
Conversation
description="The physical size (in meters) of a pixel when rendered on a screen" | ||
), | ||
] = 0.28e-3 | ||
|
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.
renderingPixelSize
is not part of the OGC specification for the TileMatrix object but we could resolve it by using `private variable like https://github.com/developmentseed/morecantile/blob/main/morecantile/models.py#L384-L387
@@ -713,8 +724,15 @@ def _resolution(self, matrix: TileMatrix) -> float: | |||
The pixel size of the tile can be obtained from the scaleDenominator | |||
by multiplying the later by 0.28 10-3 / metersPerUnit. | |||
|
|||
Note that 0.28e-3 is a standardized rendering pixel size representing the physical size | |||
of a pixel when rendered on a screen. Some usages might favor a different size, which is | |||
why this default value can be overridden when constructing a custom TileMatrixSet. |
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.
👍
Microsoft Windows and ESRI together 🤝 😅 Thanks for this great explanation and PR @restaste 🙏
yeah, makes absolute sense BUT we don't have access to the
😓 🕳️ I don't think we can have To enable At the same time (if we can't make ESRI Change) you could open an issue in https://github.com/opengeospatial/2D-Tile-Matrix-Set/tree/master to see it we can add |
WTF Esri is not using 0.28 😓 |
I think there IS a solution, the |
Closing this one since #140 was merged. Thanks @vincentsarago ! |
Hi 👋
We've been using morecantile successfully for a while now and we started using it to connect to ArcGIS Online services, which generates custom tiling schemes.
Doing so, we noticed ArcGIS servers give a
tileInfo.dpi
value (with a value of 96 in this case). Converting this to mm gives 0.264mm, which we figured we should use instead of 0.28mm as the rendering pixel size. Since this number is used to computescaleDenominator
,resolution
and finally tile coordinates, our reasoning was that getting this number right mattered. So we forked morecantile to extend it to support a customrendering_pixel_size
parameter.The OGC specs do mention this 96 DPI vs 0.28mm as a potential source of confusion, and digging further into how tile coordinates are computed in morecantile, it seems like
rendering_pixel_size
cancels itself out in the math?scaleDenominator
is computed asscaleDenominator = resolution * meters_per_unit / rendering_pixel_size
, whereresolution
is defined as (bbox_width_meters / tile_width / 2**zoom_level
)resolution
is later recomputed from thescaleDenominator
asresolution = scaleDenominator * rendering_pixel_size / meters_per_unit
.resolution = bbox_width_meters / tile_width / 2**zoom_level
, where the rendering pixel size doesn't appear anymore.I'm probably misunderstanding some important bits, but:
rendering_pixel_size
to some value other than 0.28 does not impact the tile coordinates computations?Disclaimer: this is out of my comfort zone, happy to learn more!