📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

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

ArgumentsDescription
<geometry_or_geography1>A GEOMETRY or GEOGRAPHY object containing the points to connect. This object must be a Point, MultiPoint, or LineString.
<geometry_or_geography2>A GEOMETRY or GEOGRAPHY object containing the points to connect. This object must be a Point, MultiPoint, or LineString.

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) │ ╰───────────────────────────────────────────────────────╯

Was this page helpful?