Share via


st_distance function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns the 2D Cartesian distance between the two input geometries.

Syntax

st_distance ( geoExpr1, geoExpr2 )

Arguments

  • geoExpr1: The first GEOMETRY value.
  • geoExpr2: The second GEOMETRY 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

Examples

> SELECT st_distance(st_geomfromtext('POINT Z (0 0 300)'),st_geomfromtext('LINESTRING(-10 10,20 10)'))
  10.0