st_startpoint function
Applies to: Databricks SQL
Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
nota
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the first point of the input GEOGRAPHY or GEOMETRY value, if the input geospatial value is a non-empty linestring.
Syntax
st_startpoint ( geoExpr )
Arguments
geoExpr: AGEOGRAPHYorGEOMETRYvalue representing a linestring.
Returns
A value of type GEOGRAPHY or GEOMETRY, representing the first point of the linestring.
The SRID value of the output point is the same as that of the input value.
The dimension of the output point is the same as that of the input linestring.
The function returns NULL if the input is NULL.
Error conditions
- If the value of
geoExpris not a linestring, the function returns ST_INVALID_ARGUMENT.INVALID_TYPE. - If the value of
geoExpris an empty linestring, the function returns ST_INVALID_ARGUMENT.EMPTY_LINESTRING.
Examples
SQL
-- Returns first point of linestring with SRID.
> SELECT st_asewkt(st_startpoint(st_geomfromtext('LINESTRING(1 2,3 4,5 6)', 4326)));
SRID=4326;POINT(1 2)
-- Returns first point with ZM coordinates.
> SELECT st_asewkt(st_startpoint(st_geogfromtext('LINESTRING ZM (1 2 3 4,5 6 7 8)')));
SRID=4326;POINT ZM (1 2 3 4)