X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/41fce277cd75f866365d4fc64fdbd16fa10e25ac..ab3b556144a90efa93841d4c57f0fe5250aaf2bb:/lib/NearPoint.php diff --git a/lib/NearPoint.php b/lib/NearPoint.php index 836e017c..6a0e7598 100644 --- a/lib/NearPoint.php +++ b/lib/NearPoint.php @@ -32,6 +32,17 @@ class NearPoint return 'ST_Distance('.$this->sSQL.", $sObj)"; } + public function withinSQL($sObj) + { + return sprintf( + 'ST_DWithin(%S, ST_SetSRID(ST_Point(%F,%F),4326), %F)', + $sObj, + $this->fLon, + $this->fLat, + $this->fRadius + ); + } + /** * Check that the coordinates are valid WSG84 coordinates. */