st_dwithin 函数

适用于:已勾选“是”的 Databricks Runtime 17.1 及更高版本

重要

此功能目前以公共预览版提供。

如果两个输入几何图形之间的 2D 笛卡尔距离小于或等于输入距离,则返回 true。

语法

st_dwithin ( geo1, geo2, d )

论据

  • geo1:第一个 GEOMETRY 值。
  • geo2:第二个 GEOMETRY 值。
  • d:距离阈值。

退货

一个 BOOLEAN 类型的值。

距离的单位是输入几何图形的坐标。

如果任何输入为NULL,该函数将返回NULL

错误条件

例子

-- 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