ST_AsMVTGeom — Transform a geometry into the coordinate space of a Mapbox Vector Tile.
geometry ST_AsMVTGeom(
geometry geom, box2d bounds, integer extent=4096, integer buffer=256, boolean clip_geom=true)
;
Transform a geometry into the coordinate space of a Mapbox Vector Tile of a set of rows corresponding to a Layer. Makes best effort to keep and even correct validity and might collapse geometry into a lower dimension in the process.
geom
is the geometry to transform.
bounds
is the geometric bounds of the tile contents without buffer.
extent
is the tile extent in tile coordinate space as defined by the specification. If NULL it will default to 4096.
buffer
is the buffer distance in tile coordinate space to optionally clip geometries. If NULL it will default to 256.
clip_geom
is a boolean to control if geometries should be clipped or encoded as is. If NULL it will default to true.
Availability: 2.4.0
SELECT ST_AsText(ST_AsMVTGeom( ST_GeomFromText('POLYGON ((0 0, 10 0, 10 5, 0 -5, 0 0))'), ST_MakeBox2D(ST_Point(0, 0), ST_Point(4096, 4096)), 4096, 0, false)); st_astext -------------------------------------------------------------------- MULTIPOLYGON(((5 4096,10 4096,10 4091,5 4096)),((5 4096,0 4096,0 4101,5 4096)))