The ST_LineFromText() function

The ST_LineFromText() function takes a well-known text representation of type ST_LineString and a spatial reference ID and returns an ST_LineString.

Syntax

ST_LineFromText(WKT lvarchar, SRID integer)

Return type

ST_LineString

Example

The linestring_test table is created with a single ln1 ST_LineString column:
CREATE TABLE linestring_test (ln1 ST_LineString);
The following INSERT statement inserts an ST_LineString into the ln1 column using the ST_LineFromText() function:
INSERT INTO linestring_test VALUES(
   ST_LineFromText('linestring(10.01 20.03,20.94 21.34,35.93 19.04)',1000)
);