Pular para o conteúdo principal

st_distance function

Applies to: check marked yes Databricks SQL check marked yes 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 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

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