ST_DWITHIN
Returns TRUE if two GEOMETRY objects are within the specified Euclidean distance.
This function only supports GEOMETRY values.
Syntax
ST_DWITHIN(<geometry1>, <geometry2>, <distance>)
Arguments
Return Type
Boolean.
Examples
SELECT ST_DWITHIN(TO_GEOMETRY('POINT(0 0)'), TO_GEOMETRY('POINT(1 1)'), 1.5);
╭───────────────────────────────────────────────────────────────────────╮
│ st_dwithin(to_geometry('POINT(0 0)'), to_geometry('POINT(1 1)'), 1.5) │
├───────────────────────────────────────────────────────────────────────┤
│ true │
╰───────────────────────────────────────────────────────────────────────╯
SELECT ST_DWITHIN(TO_GEOMETRY('POINT(0 0)'), TO_GEOMETRY('LINESTRING(2 0, 2 2)'), 1.9);
╭─────────────────────────────────────────────────────────────────────────────────╮
│ st_dwithin(to_geometry('POINT(0 0)'), to_geometry('LINESTRING(2 0, 2 2)'), 1.9) │
├─────────────────────────────────────────────────────────────────────────────────┤
│ false │
╰─────────────────────────────────────────────────────────────────────────────────╯