共用方式為


st_dwithin函式

適用於:核取標示為是 Databricks SQL 核取標示為是 Databricks Runtime 17.1 和更新版本

Important

這項功能目前處於 公開預覽版

備註

這項功能不適用於 Databricks SQL Classic 倉儲。 若要深入瞭解 Databricks SQL 倉儲,請參閱 SQL 倉儲類型

如果兩個輸入 GEOMETRY 值之間的 2D 笛卡爾距離小於或等於輸入距離值,則傳回 true。

Syntax

st_dwithin ( geoExpr1, geoExpr2, distanceExpr )

Arguments

  • geoExpr1:第一個 GEOMETRY 值。
  • geoExpr2:第二個 GEOMETRY 值。
  • distanceExpr:距離臨界值。

Returns

類型 BOOLEAN的值 ,指出兩個輸入 GEOMETRY 值的距離是否小於或等於 的 distanceExpr值。

距離臨界值的單位是輸入幾何圖形座標的單位。

如果任何輸入為 NULL,則函式會傳NULL回 。

錯誤條件

Examples

-- Returns true as the distance between the point and linestring is within the threshold.
> SELECT st_dwithin(st_geomfromtext('POINT Z (0 0 300)'),st_geomfromtext('LINESTRING(-10 10,20 10)'), 10.0);
  true
-- Returns false as the distance between the geometries exceeds the threshold.
> SELECT st_dwithin(st_geomfromtext('POINT(0 0)'),st_geomfromtext('POINT(20 20)'), 10.0);
  false