适用于:
Databricks SQL
Databricks Runtime 17.1 及更高版本
Important
此功能目前以公共预览版提供。
注释
此功能在 Databricks SQL 经典仓库上不可用。 若要详细了解 Databricks SQL 仓库,请参阅 SQL 仓库类型。
如果两个输入 GEOMETRY 值之间的 2D 笛卡尔距离小于或等于输入距离值,则返回 true。
Syntax
st_dwithin ( geoExpr1, geoExpr2, distanceExpr )
Arguments
-
geoExpr1:第一个GEOMETRY值。 -
geoExpr2:第二个GEOMETRY值。 -
distanceExpr:距离阈值。
Returns
类型的 BOOLEAN值,指示两个输入 GEOMETRY 值的距离是较小还是等于值 distanceExpr。
距离阈值的单位是输入几何图形的坐标。
如果任何输入为NULL,该函数将返回NULL。
错误条件
- 如果两个输入几何图形具有不同的 SRID 值,函数将返回 ST_DIFFERENT_SRID_VALUES。
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