Skip to content

ST_LINESTRING

Creates a LineString geometry from the points of Point, MultiPoint, or LineString GEOGRAPHY objects.

See also:

Syntax

sql
ST_LINESTRING(<a>, <b>)

Arguments

  • <a>, <b>: The GEOGRAPHY objects of type ST_Point or ST_LineString

Returns

Returns a GEOGRAPHY of type ST_LineString containing all points from the input geographies.

Examples

sql
SELECT ST_AsText(ST_LINESTRING(ST_POINT(1,2), ST_POINT(3,4)));
-- 'LINESTRING (1 2, 3 4)'

SELECT ST_AsText(ST_LINESTRING(ST_LINESTRING(ST_POINT(1,2), ST_POINT(3,4)), ST_POINT(5, 6)));
-- 'LINESTRING (1 2, 3 4, 5 6)'