Point geometries getting returned over Polygons at low zoom levels in the tiles #974
-
In my Mapbox GL frontend application using Martin as a tile server, I've noticed that at low zoom levels (<4), the tile responses contain point geometries, and polygon geometries are noticeably absent. Through debugging, I've traced this behavior to the SQL queries executed by Martin, which result in empty tiles for point geometries with no polygons at low zoom levels. As an example, consider the following SQL query:
To address this issue, I found that I needed to increase the extent parameter from the default value of 4096 to 20000 or higher to make polygons appear at lower zoom levels. I would like to understand why this behavior occurs and whether there is an alternative solution that allows polygons to be displayed at lower zoom levels without the need to significantly increase the extent parameter. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The ST_AsMVTGeom drops any polygons that are too small - this is by design. The whole idea of a tile is that if you zoom out, you should get only the things that are big enough to be seen to keep the tiles small. As you zoom in, as long as the polygon is large enough, it will be included (bigger than 1 "pixel" - where a pixel is a number of integers in one tile -- this is what extent is). Pixels on the other hand have no such filtering mechanism. Pixel by definition has no size. So Postgres includes all of them, and it is up to you to filter pixels based on some other criteria, for example if the pixel is a city, you may want to only include cities with large population when viewing low zooms. |
Beta Was this translation helpful? Give feedback.
The ST_AsMVTGeom drops any polygons that are too small - this is by design. The whole idea of a tile is that if you zoom out, you should get only the things that are big enough to be seen to keep the tiles small. As you zoom in, as long as the polygon is large enough, it will be included (bigger than 1 "pixel" - where a pixel is a number of integers in one tile -- this is what extent is).
Pixels on the other hand have no such filtering mechanism. Pixel by definition has no size. So Postgres includes all of them, and it is up to you to filter pixels based on some other criteria, for example if the pixel is a city, you may want to only include cities with large population when viewing low z…