X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/25baaf530dea28b7cf3c72ba4e83f3ebed05629f..e68c1132da248d0225642987593d191f8291f412:/lib/template/address-geocodejson.php?ds=inline diff --git a/lib/template/address-geocodejson.php b/lib/template/address-geocodejson.php index 480a4f9e..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) )); }