Name

ST_NodeLine — Returns a Line split at self intersection points, by adding nodes there.

Synopsis

geometry ST_NodeLine(bytea LineString);

Alias

NodeLine

Description

Returns a LineString split at self intersection points, by adding nodes there. This method supports LineString, MultiLineString or GeometryCollection geometries.

[Note]

In 3d or 4d geometries, new vertices will have Z or M=0.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

--Ex 1
SELECT ST_AsText(ST_NodeLine(ST_GeomFromText('LINESTRING (1 1, 2 3, 2 6, 6 6, 6 2, 0 2, 0 2)')));
--Result
MULTILINESTRING ((1 1, 1.5 2), (1.5 2, 2 3, 2 6, 6 6, 6 2, 1.5 2), (1.5 2, 0 2))

--Ex 2
SELECT ST_AsText(ST_NodeLine(ST_GeomFromText('MULTILINESTRING ((2 1 5, 5 5 10), 
  (6 2 2, 2 4 4))')));
--Result
MULTILINESTRING ((2 1 5, 3.636363636363636 3.181818181818182 0), 
 (3.636363636363636 3.181818181818182 0, 5 5 10), (6 2 2, 3.636363636363636 3.181818181818182 0), 
 (3.636363636363636 3.181818181818182 0, 2 4 4))
GeomA
ST_Nodeline(GeomA)
GeomA
ST_Nodeline(GeomA)

Related functions

ST_CleanPolygon