Skip to main content

st_endpoint function

Applies to: check marked yes Databricks Runtime 17.1 and above

Preview

This feature is in Public Preview.

Returns the last point of the input GEOGRAPHY or GEOMETRY value, if the input geospatial value is a non-empty linestring.

Syntax

st_endpoint ( geoExpr )

Arguments

  • geoExpr: A GEOGRAPHY or GEOMETRY value representing a linestring.

Returns

A value of type GEOGRAPHY or GEOMETRY, representing the last 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

Examples

SQL
-- Returns the endpoint of a linestring geometry.
> SELECT st_asewkt(st_endpoint(st_geomfromtext('LINESTRING(1 2,3 4,5 6)', 4326)));
SRID=4326;POINT(5 6)
-- Returns the endpoint of a linestring geography with Z and M coordinates.
> SELECT st_asewkt(st_endpoint(st_geogfromtext('LINESTRING ZM (1 2 3 4,5 6 7 8)')));
SRID=4326;POINT ZM (5 6 7 8)