]> git.openstreetmap.org Git - nominatim.git/commitdiff
use already existing address field in geocodejson
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Jul 2018 19:26:54 +0000 (21:26 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Jul 2018 19:58:41 +0000 (21:58 +0200)
lib/Geocode.php
lib/PlaceLookup.php
lib/template/search-geocodejson.php
website/reverse.php

index 948cc0a65c7dfadaf2bd6891dc0d4d30e9da1a17..2bb940522fc13065de901f3054d6da0bfc64817e 100644 (file)
@@ -250,10 +250,12 @@ class Geocode
         $this->oPlaceLookup->setIncludeAddressDetails(false);
         $this->oPlaceLookup->setIncludePolygonAsPoints($oParams->getBool('polygon'));
 
-        if ($oParams->getString('format', '') == 'geocodejson') {
-            $this->oPlaceLookup->setAddressDetails(true);
+        if ($this->bIncludeAddressDetails
+            && $oParams->getString('format', '') == 'geocodejson'
+           ) {
             $this->oPlaceLookup->setAddressAdminLevels(true);
         }
+
     }
 
     public function setQueryFromParams($oParams)
index 57d6166e6c3e400e3d3803f535d026f820d6b23e..f0db09c9be7f0403c0179f6f3e63ba07c9644162 100644 (file)
@@ -43,11 +43,6 @@ class PlaceLookup
         $this->bIncludePolygonAsPoints = $b;
     }
 
-    public function setAddressDetails($b = true)
-    {
-        $this->bAddressDetails = $b;
-    }
-
     public function setAddressAdminLevels($b = true)
     {
         $this->bAddressAdminLevels = $b;
index 252997169d548d0731ed1d437d5f243a01eb1591..6f822799dbc0161eaacfc0ae3b5a956e3142f498 100644 (file)
@@ -35,8 +35,8 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
                       );
 
     foreach ($aFieldMappings as $sFrom => $sTo) {
-        if (isset($aPointDetails['aAddress'][$sFrom])) {
-            $aPlace['properties']['geocoding'][$sTo] = $aPointDetails['aAddress'][$sFrom];
+        if (isset($aPointDetails['address'][$sFrom])) {
+            $aPlace['properties']['geocoding'][$sTo] = $aPointDetails['address'][$sFrom];
         }
     }
 
index 3d5a3ec78e9d35a777f681d76cee0bfe1ac9780a..db783455432596dae17836105b9509f949efe268 100755 (executable)
@@ -24,7 +24,7 @@ $hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
 $oPlaceLookup = new Nominatim\PlaceLookup($oDB);
 $oPlaceLookup->loadParamArray($oParams);
 if ($sOutputFormat == 'geocodejson') {
-    $oPlaceLookup->setAddressDetails(true);
+    $oPlaceLookup->setIncludeAddressDetails(true);
     $oPlaceLookup->setAddressAdminLevels(true);
 }