This topic describes the ST_LineFromText function. This function constructs a LineString object by using a Well-Known Text (WKT) string and a spatial reference identifier (SRID).
Syntax
geometry ST_LineFromText(text wKT);
geometry ST_LineFromText(text wKT , integer srid);Parameters
| Parameter | Description |
|---|---|
| WKT | The WKT string that you want to specify. |
| srid | The SRID of the LineString object. |
Description
- If you do not specify an SRID, the default SRID 0 is used.
- If the WKT string that you specify does not represent a LineString object, this function returns NULL.
Examples
SELECT ST_AsText(ST_LineFromText('LINESTRING(1 2, 3 4)'));
st_astext
---------------------
LINESTRING(1 2,3 4)
(1 row)