- Categories:
ST_ MAKELINE¶
Constructs a GEOGRAPHY or GEOMETRY object that represents a line connecting the points in the input objects.
- See also:
Syntax¶
Arguments¶
geography_expression_1A GEOGRAPHY object containing the points to connect. This object must be a Point, MultiPoint, or LineString.
geography_expression_2A GEOGRAPHY object containing the points to connect. This object must be a Point, MultiPoint, or LineString.
geometry_expression_1A GEOMETRY object containing the points to connect. This object must be a Point, MultiPoint, or LineString.
geometry_expression_2A GEOMETRY object containing the points to connect. This object must be a Point, MultiPoint, or LineString.
Returns¶
The function returns a value of type GEOGRAPHY or GEOMETRY. The value is a LineString that connects all of the points specified by the input GEOGRAPHY or GEOMETRY objects.
Usage notes¶
- If an input GEOGRAPHY object contains multiple points, ST_MAKELINE connects all of the points specified in the object.
- ST_MAKELINE connects the points in the order in which they are specified in the input.
- For GEOMETRY objects, the function reports an error if the two input GEOMETRY objects have different SRIDs.
- For GEOMETRY objects, the returned GEOMETRY object has the same SRID as the input.
Examples¶
GEOGRAPHY examples¶
The examples in this section display output in WKT format:
The following example uses ST_MAKELINE to construct a LineString that connects two Points:
The following example constructs a LineString that connects a Point with the points in a MultiPoint:
As demonstrated by the output of the example, ST_MAKELINE connects the points in the order in which they are specified in the input.
The following example constructs a LineString that connects the points in a MultiPoint with another LineString:
GEOMETRY examples¶
The examples in this section display output in WKT format:
The first example constructs a line between two Points:
The next example demonstrates creating a LineString that connects points in a MultiPoint with a Point
The following example constructs a LineString that connects the points in a MultiPoint with another LineString: