This topic describes the ST_LineMerge function. This function returns one or more LineString objects concatenated by a MultiLineString object.

Syntax

geometry  ST_LineMerge(geometry  amultilinestring);

Parameters

Parameter Description
amultilinestring The geometry object that you want to specify.

Description

  • The ST_LineMerge function supports MultiLineString objects and LineString objects. If you specify an object of another type, the ST_LineMerge function returns an empty GeometryCollection object.
  • This function deletes the m coordinates of MultiLineString objects.

Examples

SELECT ST_AsText(ST_LineMerge(ST_GeomFromText('MULTILINESTRING((1 1,2 1),(2 1,2 2))')));
        st_astext
-------------------------
 LINESTRING(1 1,2 1,2 2)
(1 row)