ST_MAKELINE
Constructs a GEOMETRY or GEOGRAPHY object that represents a line connecting the points in the input two GEOMETRY or GEOGRAPHY objects.
Syntax
ST_MAKELINE(<geometry_or_geography1>, <geometry_or_geography2>)
Aliases
Arguments
Return Type
Geometry.
Examples
GEOMETRY examples
SELECT
ST_MAKELINE(
ST_GEOMETRYFROMWKT(
'POINT(-122.306100 37.554162)'
),
ST_GEOMETRYFROMWKT(
'POINT(-104.874173 56.714538)'
)
) AS pipeline_line;
┌───────────────────────────────────────────────────────┐
│ pipeline_line │
├───────────────────────────────────────────────────────┤
│ LINESTRING(-122.3061 37.554162,-104.874173 56.714538) │
└───────────────────────────────────────────────────────┘
GEOGRAPHY examples
SELECT
ST_MAKELINE(
ST_GEOGFROMWKT(
'POINT(-122.306100 37.554162)'
),
ST_GEOGFROMWKT(
'POINT(-104.874173 56.714538)'
)
) AS pipeline_line;
╭───────────────────────────────────────────────────────╮
│ pipeline_line │
├───────────────────────────────────────────────────────┤
│ LINESTRING(-122.3061 37.554162,-104.874173 56.714538) │
╰───────────────────────────────────────────────────────╯