]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/search-geocodejson.php
address ranks must not invert admin_level hierarchy
[nominatim.git] / lib / template / search-geocodejson.php
index c046b4affdde1db98be548913c2521bda6947f16..3e3a31c443c7948b58e6f8c5500fc366b7f34ad0 100644 (file)
@@ -20,11 +20,13 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
 
     $aPlace['properties']['geocoding']['label'] = $aPointDetails['langaddress'];
 
-    $aPlace['properties']['geocoding']['name'] = $aPointDetails['placename'];
+    if ($aPointDetails['placename'] !== null) {
+        $aPlace['properties']['geocoding']['name'] = $aPointDetails['placename'];
+    }
 
     if (isset($aPointDetails['address'])) {
         $aPointDetails['address']->addGeocodeJsonAddressParts(
-          $aPlace['properties']['geocoding']
+            $aPlace['properties']['geocoding']
         );
 
         $aPlace['properties']['geocoding']['admin']