Transforms a 3D geometry into the tile coordinate system required by ST_AsMVT3D.
Syntax
geometry ST_AsMVTGeom3D(
geometry geom,
box2d bounds,
integer extent = 4096,
integer buffer = 256,
boolean clip_geom = true
);Parameters
| Parameter | Description |
|---|---|
geom | The 3D geometry object to transform. |
bounds | The rectangular boundaries of the tile, excluding the buffer. To generate boundaries, call ST_TileEnvelope. |
extent | The tile size in the tile coordinate system. Valid values: 256 to 8192. Default value: 4096. |
buffer | The buffer size in the tile coordinate system. Valid values: 1 to 4096. Default value: 256. |
clip_geom | Specifies whether to clip the 3D geometry object at tile boundaries. Default value: true. |
Usage notes
This function is upgraded from ST_AsMVTGeom with added support for transforming z-axis data of 3D geometries.
The
boundsparameter must provide tile rectangle boundaries in the required spatial coordinate so that the geometry can be transformed and clipped correctly.This function does not support 3D polygon objects that have inner shells.
Example
SELECT ST_AsText(ST_AsMVTGeom3D(ST_Transform('SRID=4326; LINESTRING(-10 -10 30, -10 -20 30)'::geometry, 3857), ST_TileEnvelope(1, 0, 0))) AS geom;Output:
geom
------------------------------------------------------------------------------------
MULTILINESTRING Z ((3868.44444444444 4324.7197219642 30,3868.44444444444 4352 30))
(1 row)