use already existing address field in geocodejson

This commit is contained in:
Sarah Hoffmann
2018-07-06 21:26:54 +02:00
parent f50f46c1ce
commit 01d5ecb86b
4 changed files with 7 additions and 10 deletions

View 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)

View 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;

View 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];
}
}

View File

@@ -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);
}