]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix viewbox issues
authorBrian Quinion <brian.quinion@mapquest.com>
Fri, 30 Aug 2013 12:04:33 +0000 (13:04 +0100)
committerBrian Quinion <brian.quinion@mapquest.com>
Fri, 6 Sep 2013 08:47:46 +0000 (09:47 +0100)
lib/Geocode.php
lib/template/search-xml.php
website/search.php

index 51ed32055c578d8557b0da55b89fd6c0bdf99336..7eab3678563464042c986f42c2d3e5990dc38519 100644 (file)
                        $this->aViewBox = array($fLeft, $fBottom, $fRight, $fTop);
                }
 
+               function getViewBoxString()
+               {
+                       if (!$this->aViewBox) return null;
+                       return $this->aViewBox[0].','.$this->aViewBox[3].','.$this->aViewBox[2].','.$this->aViewBox[1];
+               }
+
                function setRoute($aRoutePoints)
                {
                        $this->aRoutePoints = $aRoutePoints;
index b78c23eab869f63654b181db6d89092c67370d58..dfcf1375e95231e7f7252ec9d373a040106ec5d8 100644 (file)
@@ -9,7 +9,7 @@
        echo " timestamp='".date(DATE_RFC822)."'";
        echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
        echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
-       if (isset($_GET['viewbox']) && $_GET['viewbox']) echo " viewbox='".htmlspecialchars($_GET['viewbox'], ENT_QUOTES)."'";
+       if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
        echo " polygon='".($bShowPolygons?'true':'false')."'";
        if (sizeof($aExcludePlaceIDs))
        {
index e9f13632ad495caea70b5b873d613b69d5fae07c..f1ddbbe5d8f9f691cd9dfdb90768943843bb0c2f 100755 (executable)
@@ -63,8 +63,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]);
 
        $bAsText = $oGeocode->getIncludePolygonAsText();
        $sQuery = $oGeocode->getQueryString();
+       $sViewBox = $oGeocode->getViewBoxString();
+       $bShowPolygons = (isset($_GET['polygon']) && isset($_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);