This topic describes the ST_Segmentize function. This function returns a geometry or geography object for which the largest segment is no longer than the specified length.
Syntax
geometry ST_Segmentize(geometry geom , float maxSegmentLength);
geography ST_Segmentize(geography geog , float maxSegmentLength);Parameters
| Parameter | Description |
|---|---|
| geom | The geometry object that you want to specify. |
| maxSegmentLength | The specified length. |
| geog | The geography object that you want to specify. |
Description
- The ST_Segmentize function calculates lengths only in 2D.
- If you specify a geometry object, the unit of the specified length is in spatial reference.
- If you specify a geography object, the unit of the specified length is meters.
- The ST_Segmentize function does not stretch segments whose length is shorter than the specified length.
Examples
SELECT ST_AsText(ST_Segmentize(ST_GeomFromText('LINESTRING(2 1,1 1)'),0.5));
st_astext
---------------------------
LINESTRING(2 1,1.5 1,1 1)
(1 row)