X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/662af7831911994ec38b6e23a16e18c791b79203..1ccf4fb92fe71e9e2bc0baabfb2e92cd79166dae:/website/search.php diff --git a/website/search.php b/website/search.php index 26f7b2a6..29c87320 100755 --- a/website/search.php +++ b/website/search.php @@ -20,6 +20,13 @@ $aLangPrefOrder = getPreferredLanguages(); $oGeocode->setLanguagePreference($aLangPrefOrder); + /* + if (isset($aLangPrefOrder['name:de'])) $oGeocode->setReverseInPlan(true); + if (isset($aLangPrefOrder['name:ru'])) $oGeocode->setReverseInPlan(true); + if (isset($aLangPrefOrder['name:ja'])) $oGeocode->setReverseInPlan(true); + if (isset($aLangPrefOrder['name:pl'])) $oGeocode->setReverseInPlan(true); + */ + function loadParamsToGeocode($oGeocode, $aParams, $bBatch = false) { if (isset($aParams['addressdetails'])) $oGeocode->setIncludeAddressDetails((bool)$aParams['addressdetails']); @@ -55,7 +62,7 @@ $aCountryCodes[] = strtolower($sCountryCode); } } - $oGeocode->setCountryCodeList($aCountryCodes); + $oGeocode->setCountryCodesList($aCountryCodes); } if (isset($aParams['viewboxlbrt']) && $aParams['viewboxlbrt']) @@ -63,8 +70,7 @@ $aCoOrdinatesLBRT = explode(',',$aParams['viewboxlbrt']); $oGeocode->setViewBox($aCoOrdinatesLBRT[0], $aCoOrdinatesLBRT[1], $aCoOrdinatesLBRT[2], $aCoOrdinatesLBRT[3]); } - - if (isset($aParams['viewbox']) && $aParams['viewbox']) + else if (isset($aParams['viewbox']) && $aParams['viewbox']) { $aCoOrdinatesLTRB = explode(',',$aParams['viewbox']); $oGeocode->setViewBox($aCoOrdinatesLTRB[0], $aCoOrdinatesLTRB[3], $aCoOrdinatesLTRB[2], $aCoOrdinatesLTRB[1]); @@ -108,6 +114,7 @@ if (!$sQuery) { $oGeocode->setStructuredQuery(@$aParams['amenity'], @$aParams['street'], @$aParams['city'], @$aParams['county'], @$aParams['state'], @$aParams['country'], @$aParams['postalcode']); + $oGeocode->setReverseInPlan(false); } else { @@ -152,7 +159,7 @@ } exit; } - $oGeocode->setIncludePolygonAsText($bAsPoints); + $oGeocode->setIncludePolygonAsPoints($bAsPoints); $oGeocode->setIncludePolygonAsText($bAsText); $oGeocode->setIncludePolygonAsGeoJSON($bAsGeoJSON); $oGeocode->setIncludePolygonAsKML($bAsKML); @@ -161,7 +168,7 @@ loadParamsToGeocode($oGeocode, $_GET, false); - if (isset($_GET['batch'])) + if (CONST_Search_BatchMode && isset($_GET['batch'])) { $aBatch = json_decode($_GET['batch'], true); $aBatchResults = array(); @@ -187,12 +194,15 @@ $bAsText = $oGeocode->getIncludePolygonAsText(); $sQuery = $oGeocode->getQueryString(); + $sViewBox = $oGeocode->getViewBoxString(); + $bShowPolygons = (isset($_GET['polygon']) && $_GET['polygon']); + $aExcludePlaceIDs = $oGeocode->getExcludedPlaceIDs(); $sMoreURL = CONST_Website_BaseURL.'search?format='.urlencode($sOutputFormat).'&exclude_place_ids='.join(',',$oGeocode->getExcludedPlaceIDs()); if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) $sMoreURL .= '&accept-language='.$_SERVER["HTTP_ACCEPT_LANGUAGE"]; - if (isset($_GET['polygon']) && isset($_GET['polygon'])) $sMoreURL .= '&polygon=1'; + if ($bShowPolygons) $sMoreURL .= '&polygon=1'; if ($oGeocode->getIncludeAddressDetails()) $sMoreURL .= '&addressdetails=1'; - if (isset($_GET['viewbox']) && $_GET['viewbox']) $sMoreURL .= '&viewbox='.urlencode($_GET['viewbox']); + if ($sViewBox) $sMoreURL .= '&viewbox='.urlencode($sViewBox); if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon']; $sMoreURL .= '&q='.urlencode($sQuery);