ST_DWithin¶
Returns true if two geometries or geographies are within a specified distance of each other.
Usage¶
boolean ST_DWithin(geomA: geometry, geomB: geometry, distance: double)
boolean ST_DWithin(geogA: geography, geogB: geography, distance: double)
Arguments¶
- geogA (geography): Input geography
- geogB (geography): Input geography
- distance (double)
- geomA (geometry): Input geometry
- geomB (geometry): Input geometry
Description¶
For geography, the distance is specified in meters and represents the spherical approximation of the geodesic distance between the two geographies.
Examples¶
SELECT ST_DWithin(
ST_Point(0, 0),
ST_Point(1, 1),
2
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_dwithin(st_point(Int64(0),Int64(0)),st_point(Int64(1),Int64(1)),Int64(2)) │
│ boolean │
╞══════════════════════════════════════════════════════════════════════════════╡
│ true │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_DWithin(
ST_GeogPoint(0, 0),
ST_GeogPoint(1, 1),
200000
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_dwithin(st_geogpoint(Int64(0),Int64(0)),st_geogpoint(Int64(1),Int64(1)),I │
│ nt64(200000))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ true │
└──────────────────────────────────────────────────────────────────────────────┘