]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/Geocode.php
remove duplicate reverse geocoding code
[nominatim.git] / lib / Geocode.php
index a01abbc564dd26a869eb57cdf212c1f64f62c16a..2d246d98ae16b8209596de6ed470e88a95890c99 100644 (file)
@@ -1,5 +1,6 @@
 <?php
        require_once(CONST_BasePath.'/lib/PlaceLookup.php');
+       require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
 
        class Geocode
        {
                        else
                        {
                                // Just interpret as a reverse geocode
-                               $iPlaceID = geocodeReverse((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]);
-                               if ($iPlaceID)
-                                       $aSearchResults = $this->getDetails(array($iPlaceID));
+                               $oReverse = new ReverseGeocode($this->oDB);
+                               $oReverse->setLatLon((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]);
+                               $oReverse->setZoom(18);
+
+                               $aLookup = $oReverse->lookup(false);
+
+                               if (CONST_Debug) var_dump("Reverse search", $aLookup);
+
+                               if ($aLookup['place_id'])
+                                       $aSearchResults = $this->getDetails(array($aLookup['place_id'] => -1));
                                else
                                        $aSearchResults = array();
                        }