Skip to main content
Returns a modified geometry having no segment longer than the given max_segment_length. The length calculation is performed in 2D. When a segment is longer than the specified maximum length, it is split into multiple, equal-length subsegments. ST_Segmentize

Signatures

ST_Segmentize(geom: Geometry, max_segment_length: Double)

Parameters

geom
Geometry
required
The input geometry.
max_segment_length
Double
required
The max_segment_length value.

Return type

The resulting geometry.

Examples

Long segments are split evenly into subsegments no longer than the specified length. Shorter segments are not modified.
SELECT ST_AsText(ST_Segmentize(ST_GeomFromText('MULTILINESTRING((0 0, 0 1, 0 9),(1 10, 1 18))'), 5));
MULTILINESTRING((0 0,0 1,0 5,0 9),(1 10,1 14,1 18))
SELECT ST_AsText(ST_Segmentize(ST_GeomFromText('POLYGON((0 0, 0 8, 30 0, 0 0))'), 10));
POLYGON((0 0,0 8,7.5 6,15 4,22.5 2,30 0,20 0,10 0,0 0))