-
Notifications
You must be signed in to change notification settings - Fork 137
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
Bug fix tile_to_bbox(): use pixel_width instead of extent. #333
Conversation
I could be wrong, but I suspect this was a bug in Mapnik in that case. My understanding is that I do not understand what dividing by |
Hi @nyurik |
@lazaa32 what are the units of measurements for the pixel_scale and buffer_size? I think the legacy tile is 256x256 pixels (raster), whereas the vector tile is (i guess) 4096x4096 (extent). If the measurement for buffer_size was in pixels, than yes - we need to convert 256 to be the width of a tile. I can't recall if we have 256 hardcoded anywhere. |
@nyurik I think that We probably don't want to modify the |
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.
thx, makes sense now
please re-run |
This PR fixes two issues: 1. Before `ST_AsMVTGeom(geometry, ST_TileEnvelope(zoom, x, y), extent, buffer, true)` function read `buffer` from layer yaml definition `buffer_size` (e.g. 256 for layer place). Which is in pixels but should be in vector tile unit because it is compared to `extent` (4096). Related to PR #333. 2. When replacing `!pixel_width!` and `!pixel_height!` in Mapnik query, `self.pixel_width` and `self.pixel_height` are used. That means that a constant value `pixel_scale` is used throughout all zooms. However I checked logs from Mapnik rendering and following values for `pixel_width` are used: Zoom|pixel_width | --|------------| 1| 78271.5| 2| 39135.8| 3| 19567.9| 4| 9783.94| 5| 4891.97| 6| 2445.98| 7| 1222.99| 8| 611.496| 9| 305.748| 10| 152.874| 11| 76.437 | 12| 38.2185| 13| 19.1093| 14| 9.55463| I modified the tool so it calculates pixel_width (which is actually zoom resolution meters/pixel) for each zoom_level. Using constant value for `pixel_width` leads to having different number of features in a same tile rendered via PgQuery and Mapnik.
When PgQuery makes a query into postgres it uses smaller tile buffer than Mapnik.
In example below layer
place
has abuffer_size
set to 256.Example:
Queried tile: 7/69/43
Queried layer:
layer_place
Green: bbox of tile
Purple: bbox of PgQuery query of
layer_place
before bug fixBlue dash: bbox of PgQuery query of
layer_place
after bug fixRed dot dash: bbox of Mapnik query of
layer_place
Blue: