]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib / lib.php
index 54c8c7d0d7176c581b1e92d5b9d89c3e229f928a..482e95981cc04b7aab021eb82e979c9e950727a9 100644 (file)
 
                if (sizeof($aNearPostcodes))
                {
-                       return array(array('lat' => $aNearPostcodes[0]['lat'], 'lon' => $aNearPostcodes[0]['lon'], 'radius' => 0.005));
+                       $aPostcodes = array();
+                       foreach($aNearPostcodes as $aPostcode)
+                       {
+                               $aPostcodes[] = array('lat' => $aPostcode['lat'], 'lon' => $aPostcode['lon'], 'radius' => 0.005);
+                       }
+
+                       return $aPostcodes;
                }
 
                return false;
                        $sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', geometry) ASC limit 1';
                        //var_dump($sSQL);
                        $aPlace = $oDB->getRow($sSQL);
-                       $iPlaceID = $aPlace['place_id'];
-                       if (PEAR::IsError($iPlaceID))
+                       if (PEAR::IsError($aPlace))
                        {
-                               var_Dump($sSQL, $iPlaceID);
+                               var_Dump($sSQL, $aPlace);
                                exit;
                        }
+                       $iPlaceID = $aPlace['place_id'];
                }
 
                // The point we found might be too small - use the address to find what it is a child of