Skip to content

ST_LineFromText

Constructs a LineString from Well-Known Text (WKT), erroring if the input is not a LineString.

Usage

geometry ST_LineFromText(wkt: string)
geometry ST_LineFromText(wkt: string, srid: crs)

Arguments

  • wkt (string)
  • srid (crs)

Description

Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a LineString.

Aliases: ST_LineStringFromText.

Examples

SELECT ST_LineFromText('LINESTRING (0 0, 1 1, 2 2)');
┌─────────────────────────────────────────────────────┐
│ st_linefromtext(Utf8("LINESTRING (0 0, 1 1, 2 2)")) │
│                       geometry                      │
╞═════════════════════════════════════════════════════╡
│ LINESTRING(0 0,1 1,2 2)                             │
└─────────────────────────────────────────────────────┘

With an SRID or CRS:

SELECT ST_LineFromText('LINESTRING (0 0, 1 1, 2 2)', 4326);
┌─────────────────────────────────────────────────────────────────┐
│ st_linefromtext(Utf8("LINESTRING (0 0, 1 1, 2 2)"),Int64(4326)) │
│                             geometry                            │
╞═════════════════════════════════════════════════════════════════╡
│ LINESTRING(0 0,1 1,2 2)                                         │
└─────────────────────────────────────────────────────────────────┘