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 SQL
Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Note
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the spherical distance (in meters) between two point GEOMETRY values, measured on a sphere whose radius is the mean radius of the WGS84 ellipsoid.
Syntax
st_distancesphere ( geoExpr1, geoExpr2 )
Arguments
geoExpr1: The firstGEOMETRYvalue.geoExpr2: The secondGEOMETRYvalue.
Returns
Returns the spherical distance (in meters) between two point geometries, measured on a sphere whose radius is the mean radius of 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
- If any of the two input geometries is not a point, the function returns ST_INVALID_ARGUMENT.INVALID_TYPE.
- If the two input geometries have different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.
Examples
> SELECT round(st_distancesphere(st_geomfromtext('POINT M (2 3 100)'), st_geomfromtext('POINT ZM (6 7 23 1000)')), 3);
627753.245