mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
use already existing address field in geocodejson
This commit is contained in:
@@ -250,10 +250,12 @@ class Geocode
|
|||||||
$this->oPlaceLookup->setIncludeAddressDetails(false);
|
$this->oPlaceLookup->setIncludeAddressDetails(false);
|
||||||
$this->oPlaceLookup->setIncludePolygonAsPoints($oParams->getBool('polygon'));
|
$this->oPlaceLookup->setIncludePolygonAsPoints($oParams->getBool('polygon'));
|
||||||
|
|
||||||
if ($oParams->getString('format', '') == 'geocodejson') {
|
if ($this->bIncludeAddressDetails
|
||||||
$this->oPlaceLookup->setAddressDetails(true);
|
&& $oParams->getString('format', '') == 'geocodejson'
|
||||||
|
) {
|
||||||
$this->oPlaceLookup->setAddressAdminLevels(true);
|
$this->oPlaceLookup->setAddressAdminLevels(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setQueryFromParams($oParams)
|
public function setQueryFromParams($oParams)
|
||||||
|
|||||||
@@ -43,11 +43,6 @@ class PlaceLookup
|
|||||||
$this->bIncludePolygonAsPoints = $b;
|
$this->bIncludePolygonAsPoints = $b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAddressDetails($b = true)
|
|
||||||
{
|
|
||||||
$this->bAddressDetails = $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAddressAdminLevels($b = true)
|
public function setAddressAdminLevels($b = true)
|
||||||
{
|
{
|
||||||
$this->bAddressAdminLevels = $b;
|
$this->bAddressAdminLevels = $b;
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($aFieldMappings as $sFrom => $sTo) {
|
foreach ($aFieldMappings as $sFrom => $sTo) {
|
||||||
if (isset($aPointDetails['aAddress'][$sFrom])) {
|
if (isset($aPointDetails['address'][$sFrom])) {
|
||||||
$aPlace['properties']['geocoding'][$sTo] = $aPointDetails['aAddress'][$sFrom];
|
$aPlace['properties']['geocoding'][$sTo] = $aPointDetails['address'][$sFrom];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ $hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
|||||||
$oPlaceLookup = new Nominatim\PlaceLookup($oDB);
|
$oPlaceLookup = new Nominatim\PlaceLookup($oDB);
|
||||||
$oPlaceLookup->loadParamArray($oParams);
|
$oPlaceLookup->loadParamArray($oParams);
|
||||||
if ($sOutputFormat == 'geocodejson') {
|
if ($sOutputFormat == 'geocodejson') {
|
||||||
$oPlaceLookup->setAddressDetails(true);
|
$oPlaceLookup->setIncludeAddressDetails(true);
|
||||||
$oPlaceLookup->setAddressAdminLevels(true);
|
$oPlaceLookup->setAddressAdminLevels(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user