ST_DWithin
Determine whether two geometries are within the specified distance of one another.
Syntax
ST_DWithin(geo1, geo2, distance[, unit[, cSys]]);
- geo1
- The first input geometry.
Type: VARCHAR(ANY)
- geo2
- The second input geometry.
Type: VARCHAR(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'
- cSys
- The coordinate system of the input geometry.
Type: VARCHAR(ANY)
Default: The coordinate system of the input geometry's SRID or, if the input geometry has no SRID, 'WGS84'.
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_Point(0,0), inza..ST_Point(1,1), 2, 'meter', 'cartesian');
ST_DWITHIN
-----------
t
(1 row)
SELECT inza..ST_DWithin(inza..ST_Point(0,0), inza..ST_Point(1,1), 2, 'foot', 'cartesian');
ST_DWITHIN
-----------
f
(1 row)
SELECT inza..ST_DWithin(inza..ST_Point(0,0), inza..ST_Point(1,1), 2, 'meter', 'wgs84');
ST_DWITHIN
-----------
f
(1 row)