Returns a modified geometry or geography having no segment longer than a given distance. Short segments are left unchanged.
Syntax
geometry ST_Segmentize(geometry geom , float maxSegmentLength);
geography ST_Segmentize(geography geog , float maxSegmentLength);Parameters
| Parameter | Description |
|---|---|
geom | The geometry object to segmentize. |
geog | The geography object to segmentize. |
maxSegmentLength | The maximum segment length. For geometry, the unit follows the spatial reference of the input. For geography, the unit is meters. |
Usage notes
Length is calculated in 2D only.
Only segments longer thanmaxSegmentLengthare split. Segments shorter thanmaxSegmentLengthare not modified.
Examples
Segmentize a line
The 1-unit segment (2 1, 1 1) is split into two 0.5-unit subsegments, adding vertex (1.5 1).
SELECT ST_AsText(ST_Segmentize(ST_GeomFromText('LINESTRING(2 1,1 1)'),0.5));Expected output:
st_astext
---------------------------
LINESTRING(2 1,1.5 1,1 1)
(1 row)See also
该文章对您有帮助吗?