]> git.openstreetmap.org Git - nominatim.git/commitdiff
Allow for reverse geocode returning no results
authorBrian Quinion <brian.quinion@mapquest.com>
Fri, 30 Aug 2013 12:13:21 +0000 (13:13 +0100)
committerBrian Quinion <brian.quinion@mapquest.com>
Fri, 6 Sep 2013 08:47:46 +0000 (09:47 +0100)
lib/Geocode.php

index 7eab3678563464042c986f42c2d3e5990dc38519..e5f3a1572832a3ed148dfca4704ac4e7c6f55543 100644 (file)
 
                function getDetails($aPlaceIDs, $iMinAddressRank = 0, $iMaxAddressRank = 30, $aAddressRankList = false, $sAllowedTypesSQLList = false, $bDeDupe = false)
                {
+                       if (sizeof($aPlaceIDs) == 0)  return array();
+
                        $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$this->aLangPrefOrder))."]";
 
                        // Get the details for display (is this a redundant extra step?)
                        }
 
                        $aSearchResults = array();
-                       if ($sQuery || $aStructuredQuery)
+                       if ($sQuery || $this->aStructuredQuery)
                        {
                                // Start with a blank search
                                $aSearches = array(
                        {
                                // Just interpret as a reverse geocode
                                $iPlaceID = geocodeReverse((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]);
-                               $aSearchResults = $this->getDetails(array($iPlaceID));
+                               if ($iPlaceID)
+                                       $aSearchResults = $this->getDetails(array($iPlaceID));
+                               else
+                                       $aSearchResults = array();
                        }
 
                        // No results? Done