X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a46c739ffb1801c83a86b4776c70a3e9cb0440c6..9ab59cdf423777105470235363919018a8cc25bb:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index a4e4aa6c..482e9598 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -246,7 +246,13 @@ 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; @@ -846,12 +852,12 @@ $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 @@ -884,17 +890,7 @@ return $iPlaceID; } - function loadStructuredAddressElement(&$aStructuredQuery, &$iMinAddressRank, &$iMaxAddressRank, &$aAddressRankList, $aParams, $sKey, $iNewMinAddressRank, $iNewMaxAddressRank, $aItemListValues) + function addQuotes($s) { - 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; + return "'".$s."'"; }