st_distance 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 2D Cartesian distance between the two input GEOMETRY values.
Syntax
st_distance ( geoExpr1, geoExpr2 )
Arguments
geoExpr1: The firstGEOMETRYvalue.geoExpr2: The secondGEOMETRYvalue.
Returns
Returns the 2D Cartesian distance between the two input geometries. The units of the result are those of the coordinates of the input geometries.
NULL is returned if any of the two input geometries is empty.
Error conditions
- If the two input geometries have different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.
Examples
SQL
> SELECT st_distance(st_geomfromtext('POINT Z (0 0 300)'),st_geomfromtext('LINESTRING(-10 10,20 10)'));
10.0