]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib / lib.php
index 3ed66237e955cdff43da2122cbcfe6bad6f52d19..482e95981cc04b7aab021eb82e979c9e950727a9 100644 (file)
 
                if (sizeof($aNearPostcodes))
                {
 
                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;
                }
 
                return false;
                        $sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', geometry) ASC limit 1';
                        //var_dump($sSQL);
                        $aPlace = $oDB->getRow($sSQL);
                        $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;
                        }
                                exit;
                        }
+                       $iPlaceID = $aPlace['place_id'];
                }
 
                // The point we found might be too small - use the address to find what it is a child of
                }
 
                // The point we found might be too small - use the address to find what it is a child of
                return $iPlaceID;
        }
 
                return $iPlaceID;
        }
 
-       function loadStructuredAddressElement(&$aStructuredQuery, &$iMinAddressRank, &$iMaxAddressRank, &$aAddressRankList, $aParams, $sKey, $iNewMinAddressRank, $iNewMaxAddressRank, $aItemListValues)
-       {
-               if (!isset($_GET[$sKey])) return false;
-               $sValue = trim($_GET[$sKey]);
-               if (!$sValue) return false;
-               $aStructuredQuery[$sKey] = $sValue;
-               if ($iMinAddressRank == 0 && $iMaxAddressRank == 30)
-               {
-                       $iMinAddressRank = $iNewMinAddressRank;
-                       $iMaxAddressRank = $iNewMaxAddressRank;
-               }
-               if ($aItemListValues) $aAddressRankList = array_merge($aAddressRankList, $aItemListValues);
-               return true;
-       }
-
        function addQuotes($s)
        {
                return "'".$s."'";
        function addQuotes($s)
        {
                return "'".$s."'";