ST_LineFromText

更新时间:
复制 MD 格式

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

ParameterDescription
wKTThe WKT string representing the geometry.
sridThe 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)