ST_DWithin
Determine whether two geometries are within the specified distance of one another.
Syntax
ST_DWithin(geo1, geo2, distance[, unit]);
- geo1
- The first input geometry.
Type: ST_GEOMETRY(ANY)
- geo2
- The second input geometry.
Type: ST_GEOMETRY(ANY)
- distance
- The separation threshold.
Type: DOUBLE
- unit
- The units of the distance. Possible values include 'meter', 'kilometer', 'foot', 'mile', and
"nautical mile'.
Type: VARCHAR(ANY)
Default: 'meter'
Returns
A value of type BOOL that is TRUE if the geometries are within the specified distance of one another; otherwise FALSE.
Examples
SELECT inza..ST_DWithin(inza..ST_Transform(inza..ST_Point(0,0), 27700), inza..ST_Transform(inza..ST_Point(1,1), 27700), 156987, 'meter');
ST_DWITHIN
------------
t
(1 row)
SELECT inza..ST_DWithin(inza..ST_Transform(inza..ST_Point(0,0), 27700), inza..ST_Transform(inza..ST_Point(1,1), 27700), 2, 'foot');
ST_DWITHIN
------------
f
(1 row)
SELECT
inza..ST_DWithin(inza..ST_Transform(inza..ST_Point(0,0), 4326), inza..ST_Transform(inza..ST_Point(1,1), 4326), 2, 'meter');
ST_DWITHIN
------------
f
(1 row)