mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
factor out geocodejson address generation
Unifies the two implementations currently used for search and address.
This commit is contained in:
@@ -101,6 +101,28 @@ class AddressDetails
|
||||
return $aAddress;
|
||||
}
|
||||
|
||||
public function addGeocodeJsonAddressParts(&$aJson)
|
||||
{
|
||||
$aFieldMappings = array(
|
||||
'house_number' => 'housenumber',
|
||||
'road' => 'street',
|
||||
'locality' => 'locality',
|
||||
'postcode' => 'postcode',
|
||||
'city' => 'city',
|
||||
'district' => 'district',
|
||||
'county' => 'county',
|
||||
'state' => 'state',
|
||||
'country' => 'country'
|
||||
);
|
||||
|
||||
$aAddrNames = $this->getAddressNames();
|
||||
foreach ($aFieldMappings as $sFrom => $sTo) {
|
||||
if (isset($aAddrNames[$sFrom])) {
|
||||
$aJson[$sTo] = $aAddrNames[$sFrom];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getAdminLevels()
|
||||
{
|
||||
$aAddress = array();
|
||||
|
||||
Reference in New Issue
Block a user