Opened 2 years ago

Closed 2 years ago

#5198 closed enhancement (fixed)

Improve Documentation of ST_AsMVTGeom

Reported by: cw Owned by: mdavis
Priority: low Milestone: PostGIS 3.4.0
Component: documentation Version: 3.2.x
Keywords: Cc: cw

Description

I made a mistake and wrote

SELECT ST_AsMVTGeom(geom, st_transform(ST_TileEnvelope(8, 135, 84), 4326))

instead of

SELECT ST_AsMVTGeom(st_transform(geom, 3857), ST_TileEnvelope(8, 135, 84))

because I thought it would be faster to transform the simple tile than the complex geometry.

This seems to work at first glance, but introduced very small errors which were only visible when zooming in more than you would typically zoom in such a tile.

Because it took me a long time to figure this out, I would like to change the documentation of ST_AsMVTGeom to clarify two things:

  • ST_AsMVTGeom ignores the srid of it's arguments
  • many frameworks expect the 2d tile coordinates to correspond to a mercator projection (i.e. SRID 3857)

Change History (5)

comment:1 by robe, 2 years ago

Milestone: PostGIS 3.2.3PostGIS 3.3.0

comment:2 by mdavis, 2 years ago

Good suggestion. I have made the suggested improvements in ST_AsMVTGeom. Also improved ST_TileEnvelope and ST_AsMVT, with more links between them.

Fixes are in https://git.osgeo.org/gitea/postgis/postgis/commit/40a051601130f7c42243f6c616951977e384f278

comment:3 by robe, 2 years ago

Milestone: PostGIS 3.3.0PostGIS 3.4.0

comment:4 by mdavis, 2 years ago

Owner: changed from robe to mdavis
Status: newassigned

comment:5 by mdavis, 2 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.