Fork me on GitHub

ST_LineFromText

Signatures

GEOMETRY ST_LineFromText(VARCHAR wkt);
GEOMETRY ST_LineFromText(VARCHAR wkt, INT srid);

Description

Converts the Well Known Text wkt into a Geometry, optionally with spatial reference id srid. Verifies that wkt does in fact specify a LINESTRING.

Note: If wkt specifies a Geometry with z-coordinates, they will be conserved in reality but suppressed when visualizing the Geometry as WKT.

Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1.

Examples

SELECT ST_LineFromText('LINESTRING(2 3, 4 6, 10 6, 12 15)');
-- Answer: LINESTRING(2 3, 4 6, 10 6, 12 15)

SELECT ST_LineFromText('LINESTRING(5 5, 1 2, 3 4, 99 3)', 2154);
-- Answer: LINESTRING(5 5, 1 2, 3 4, 99 3)

SELECT ST_LineFromText('LINESTRING(0 0 -1, 2 0 2, 2 1 3)', 2154);
-- Answer: LINESTRING(0 0, 2 0, 2 1)

SELECT ST_LineFromText('POINT(2 3)', 2154);
-- Answer: The provided WKT Geometry is not a LINESTRING.
See also