Appearance
ST_DWITHIN
Returns TRUE
if the GEOGRAPHY
objects are within the specified distance in meters.
See also:
Syntax
sql
ST_DWITHIN(<a>, <b>, <d>, <use_spheroid> = true)
Arguments
<a>
,<b>
: TheGEOGRAPHY
objects to check for proximity<d>
: The distance in meters (must be>= 0
)<use_spheroid>
: An optional boolean to control calculation accuracy:TRUE
(default): Uses the spheroidal model for higher precisionFALSE
: Uses the spherical model for faster computation
Returns
Returns a BOOLEAN
:
TRUE
if<a>
and<b>
are within the distance<d>
FALSE
if<a>
and<b>
are farther apart than<d>
or if the inputs are invalid
Example
sql
SELECT ST_DWithin('POINT(1 1)'::GEOGRAPHY, 'POINT(1.1 1.1)'::GEOGRAPHY, 16000);
-- TRUE