Introduction: Creates a geography LineString containing the coordinates of two Point, MultiPoint, or LineString geographies. Other geography types cause an error. Geography measurement functions interpret the result's edges as great-circle arcs.
Format:
ST_MakeLine(geog1: Geography, geog2: Geography)
Return type: Geography
Since: v1.9.1
Only the two-argument signature accepts Geography inputs. The array form of ST_MakeLine remains Geometry-only. Repeated and coincident Point or MultiPoint coordinates are preserved. When the second input is a LineString whose first coordinate matches the current endpoint, that seam coordinate appears only once. Empty inputs contribute no coordinates. If exactly one coordinate remains, it is repeated to produce a valid LineString.
The output copies the first input‘s SRID without transforming either input or validating that their SRIDs match. If the inputs have different SRIDs, the second input’s SRID is ignored. An SRID of 0 on the first input remains 0.
SQL Example
SELECT ST_AsText(line), ST_Length(line) FROM ( SELECT ST_MakeLine( ST_GeogFromWKT('POINT (0 0)', 4326), ST_GeogFromWKT('POINT (1 0)', 4326) ) AS line );
Output:
LINESTRING (0 0, 1 0) | 111195.06627089891