]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/address-geocodejson.php
ignore isaddress in details output when it is not present
[nominatim.git] / lib / template / address-geocodejson.php
index 032dcf4347a1046eb684a517af6cebb980aef176..98c368b324b0342b7cb3d2db804eec02337cde7c 100644 (file)
@@ -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();