]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/search.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / website / search.php
index 26f7b2a648bcebf530b57206eb61b9232ec3bdfe..e85c33697fa66554a7bb532aadf3ff3001cadedb 100755 (executable)
        $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']);
@@ -29,6 +36,8 @@
                if (isset($aParams['limit'])) $oGeocode->setLimit((int)$aParams['limit']);
                if (isset($aParams['offset'])) $oGeocode->setOffset((int)$aParams['offset']);
 
+               if (isset($aParams['fallback'])) $oGeocode->setFallback((int)$aParams['fallback']);
+
                // List of excluded Place IDs - used for more acurate pageing
                if (isset($aParams['exclude_place_ids']) && $aParams['exclude_place_ids'])
                {
@@ -55,7 +64,7 @@
                                        $aCountryCodes[] = strtolower($sCountryCode);
                                }
                        }
-                       $oGeocode->setCountryCodeList($aCountryCodes);
+                       $oGeocode->setCountryCodesList($aCountryCodes);
                }
 
                if (isset($aParams['viewboxlbrt']) && $aParams['viewboxlbrt'])
@@ -63,8 +72,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]);
                if (!$sQuery)
                {
                        $oGeocode->setStructuredQuery(@$aParams['amenity'], @$aParams['street'], @$aParams['city'], @$aParams['county'], @$aParams['state'], @$aParams['country'], @$aParams['postalcode']);
+                       $oGeocode->setReverseInPlan(false);
                }
                else
                {
                        }
                        exit;
                }
-               $oGeocode->setIncludePolygonAsText($bAsPoints);
+               $oGeocode->setIncludePolygonAsPoints($bAsPoints);
                $oGeocode->setIncludePolygonAsText($bAsText);
                $oGeocode->setIncludePolygonAsGeoJSON($bAsGeoJSON);
                $oGeocode->setIncludePolygonAsKML($bAsKML);
 
        loadParamsToGeocode($oGeocode, $_GET, false);
 
-       if (isset($_GET['batch']))
+       if (CONST_Search_BatchMode && isset($_GET['batch']))
        {
                $aBatch = json_decode($_GET['batch'], true);
                $aBatchResults = array();
 
        $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);