Constructs a LineString geometry from a Well-Known Text (WKT) string and an optional spatial reference identifier (SRID).
Syntax
geometry ST_LineFromText(text wKT);
geometry ST_LineFromText(text wKT, integer srid);Parameters
| Parameter | Description |
|---|---|
wKT | The WKT string representing the geometry. |
srid | The SRID to assign to the LineString. Defaults to 0 if omitted. |
Usage notes
If the WKT string does not represent a LineString, the function returns
NULL.
Examples
SELECT ST_AsText(ST_LineFromText('LINESTRING(1 2, 3 4)'));Output:
st_astext
---------------------
LINESTRING(1 2,3 4)
(1 row)该文章对您有帮助吗?