Share via


st_distancespheroid function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns the geodesic distance (in meters) between two point geometries on the WGS84 ellipsoid.

Syntax

st_distancespheroid ( geoExpr1, geoExpr2 )

Arguments

  • geoExpr1: The first GEOMETRY value.
  • geoExpr2: The second GEOMETRY value.

Returns

Returns the geodesic distance (in meters) between two point geometries on the WGS84 ellipsoid. The coordinates of the points are assumed to be in degrees.

NULL is returned if any of the two input geometries is empty.

Error conditions

  • An error is returned if the input geometries are not points.
  • If the two input geometries have different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.

Examples

> SELECT round(st_distancespheroid(st_geomfromtext('POINT M (2 3 100)'), st_geomfromtext('POINT ZM (6 7 23 1000)')), 3)
  626380.599