st_distance
function
Applies to: Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
Returns the 2D Cartesian distance between the two input geometries.
Syntax
st_distance ( geoExpr1, geoExpr2 )
Arguments
geoExpr1
: The firstGEOMETRY
value.geoExpr2
: The secondGEOMETRY
value.
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