Share via


st_startpoint function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns the first point of the input GEOGRAPHY or GEOMETRY value, if the input geospatial value is a non-empty linestring. Otherwise, returns NULL.

Syntax

st_startpoint ( geoExpr )

Arguments

  • geoExpr: A GEOGRAPHY or GEOMETRY value 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

Examples

-- 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)