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 | Type | Description |
|---|---|---|
| wKT | text | The WKT representation of the LineString. |
| srid | integer | The SRID to assign to the geometry. Defaults to 0 if not specified. |
Usage notes
If the WKT string does not represent a LineString, the function returns NULL.
If you omit
srid, the geometry is assigned SRID 0.
Examples
SELECT ST_AsText(ST_LineFromText('LINESTRING(1 2, 3 4)'));
st_astext
---------------------
LINESTRING(1 2,3 4)
(1 row)该文章对您有帮助吗?