]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/NearPoint.php
use NearPoint class in Search array
[nominatim.git] / lib / NearPoint.php
index 836e017c374d16e1fd4529f630f5a022a9723e70..6a0e7598627f25d9a3b5673e5be0b01a50975a54 100644 (file)
@@ -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.
      */