Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

ST_LineMerge

Introduction: Returns a LineString or MultiLineString formed by sewing together the constituent line work of a MULTILINESTRING.

Note

Only works for MULTILINESTRING. Using other geometry will return a GEOMETRYCOLLECTION EMPTY. If no merging can be performed, the original MULTILINESTRING is returned.

Format: ST_LineMerge (A: Geometry)

Since: v1.5.0

Example:

SELECT ST_LineMerge(ST_GeomFromWKT('MULTILINESTRING ((-29 -27, -30 -29.7, -45 -33), (-45 -33, -46 -32))'))

Output:

LINESTRING (-29 -27, -30 -29.7, -45 -33, -46 -32)