Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Returns true if the 2D Cartesian distance between the two input geometries is smaller than or equal to the input distance.
Syntax
st_dwithin ( geo1, geo2, d )
Arguments
geo1
: The firstGEOMETRY
value.geo2
: The secondGEOMETRY
value.d
: The distance threshold.
Returns
A value of type BOOLEAN
.
The units of the distance are those of the coordinates of the input geometries.
The function returns NULL
if any of the inputs is NULL
.
Error conditions
- If the two input geometries have different SRID values, the function returns 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