X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/be58b929f2131d2c6aaa8b5c702a574c3812371b..e68c1132da248d0225642987593d191f8291f412:/lib/template/address-geocodejson.php diff --git a/lib/template/address-geocodejson.php b/lib/template/address-geocodejson.php index 68fae7d1..98c368b3 100644 --- a/lib/template/address-geocodejson.php +++ b/lib/template/address-geocodejson.php @@ -33,24 +33,9 @@ if (empty($aPlace)) { $aFilteredPlaces['properties']['geocoding']['name'] = $aPlace['placename']; if (isset($aPlace['address'])) { - $aFieldMappings = array( - 'house_number' => 'housenumber', - 'road' => 'street', - 'locality' => 'locality', - 'postcode' => 'postcode', - 'city' => 'city', - 'district' => 'district', - 'county' => 'county', - 'state' => 'state', - 'country' => 'country' - ); - - $aAddressNames = $aPlace['address']->getAddressNames(); - foreach ($aFieldMappings as $sFrom => $sTo) { - if (isset($aAddressNames[$sFrom])) { - $aFilteredPlaces['properties']['geocoding'][$sTo] = $aAddressNames[$sFrom]; - } - } + $aPlace['address']->addGeocodeJsonAddressParts( + $aFilteredPlaces['properties']['geocoding'] + ); $aFilteredPlaces['properties']['geocoding']['admin'] = $aPlace['address']->getAdminLevels(); @@ -76,6 +61,6 @@ if (empty($aPlace)) { 'licence' => 'ODbL', 'query' => $sQuery ), - 'features' => [$aFilteredPlaces] + 'features' => array($aFilteredPlaces) )); }