Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Returns a linestring GEOMETRY
whose points are the non-empty points of the geometries in the input array of geometries, which are expected to be points, linestrings, or multipoints.
Syntax
st_makeline ( geoArray )
Arguments
geoArray
: An array ofGEOMETRY
values.
Returns
A value of type GEOMETRY
, representing a linestring.
The order of the points is preserved in the output linestring. Any NULL
values in the input array are ignored.
The SRID value of the output linestring is the common SRID value of the input geometries.
The dimension of the output linestring is the maximum common dimension of the input geometries.
If the input array is empty, the 2D empty linestring is returned. The SRID of the returned linestring is 0 in this case. If all input geometries are empty, the 2D empty linestring is returned. If the total number of non-empty points across all input geometries is one, we return a linestring with two points, both of which are equal to the unique non-empty point in the input.
The function returns NULL
if any of the inputs is NULL
.
Error conditions
- If any of the input geometries is not a point, linestring, or multipoint, the function returns ST_INVALID_ARGUMENT_TYPE.
- If the input geometries do not have the same SRID value, the function returns ST_DIFFERENT_SRID_VALUES.
Examples
-- Returns a linestring with the points of the input geometries.
> SELECT st_astext(st_makeline(array(st_geomfromtext('POINT(1 2)'),st_geomfromtext('MULTIPOINT(5 6,7 8)'),st_geomfromtext('LINESTRING(5 6,7 8,-1 -3,-7 -9,-12 -20)'))))
LINESTRING(1 2,5 6,7 8,5 6,7 8,-1 -3,-7 -9,-12 -20)