ST_MAKELINE()
All functions > GEOSPATIAL > ST_MAKELINE()
Creates a LINESTRING from two geometry or geography inputs.
Signatures
Make line
Returns: A linestring connecting the inputs
ST_MAKELINE(geo1: T, geo2: T) → GEOM_LINESTRING or GEOG_LINESTRING sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo1 | T | Yes | First geometry or geography (Point or LineString) |
geo2 | T | Yes | Second geometry or geography (Point or LineString) |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY
Signature notes:
- Point + Point: returns a 2-vertex LineString
- LineString + LineString: concatenates the two lines
- Point + LineString or LineString + Point: appends the point to the line
- Returns NULL if either input is NULL
- On Trino: transpiled via ST_LineFromMultiPoint and ST_Union
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_MAKELINE(ST_GEOMPOINT(0.0, 0.0), ST_GEOMPOINT(1.0, 1.0))) -- Line from two points
;Result
| f1 VARCHAR |
|---|
| LINESTRING (0 0, 1 1) |
On this page