I am implementing a Tile Server with the help of PostGIS.
Running this query:
SELECT ST_AsMVT(tile) FROM (
SELECT
__FEATURES__,
ST_AsMVTGeom(
ST_Transform(__GEOM__, __SRID__),
ST_Transform(ST_TileEnvelope(?, ?, ?), __SRID__),
4096,
256,
false
) as geom
FROM __SCHEMA__.__TABLE__
WHERE
__GEOM__ && ST_Transform(ST_TileEnvelope(?, ?, ?), __SRID__)
) AS tile
In 3857 projection I get a very good result.
But if I use geometries in 32632 I get the borders of the geometries not perfectly aligned and a zig-zag effect.
Why?
2
Answers
I was able to solve the issue with this query:
Where
__PROJ__,
is+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs
The coordinate precision, grid alignment, or tile settings in EPSG 32632 could be the cause of the misalignment and zigzag effect. Make sure there is enough accuracy, line up the tile grid with the UTM grid, experiment with the tile size and buffer, and confirm the grid origin. For debugging purposes, visualize the tiles and data. Your PostGIS tile server’s alignment should get better after adjusting these factors.
here is the piece of code in which values shou
The 4096 and 256 parameters may require modification according to your particular use case and data distribution.
Hope it works 🙂