From: Sarah Hoffmann Date: Fri, 6 Jul 2018 19:26:54 +0000 (+0200) Subject: use already existing address field in geocodejson X-Git-Tag: v3.2.0~53 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/01d5ecb86b10e950a087173faa666fe662e90ab0 use already existing address field in geocodejson --- diff --git a/lib/Geocode.php b/lib/Geocode.php index 948cc0a6..2bb94052 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -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) diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index 57d6166e..f0db09c9 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -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; diff --git a/lib/template/search-geocodejson.php b/lib/template/search-geocodejson.php index 25299716..6f822799 100644 --- a/lib/template/search-geocodejson.php +++ b/lib/template/search-geocodejson.php @@ -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]; } } diff --git a/website/reverse.php b/website/reverse.php index 3d5a3ec7..db783455 100755 --- a/website/reverse.php +++ b/website/reverse.php @@ -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); }