]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/search-json.php
Merge pull request #1638 from mtmail/check-for-invalid-indices
[nominatim.git] / lib / template / search-json.php
index 774b5be08b3e6bca7db863ab6584542986416cbc..6108aca4e005582d9446a75ca44737a0ab0ae5c3 100644 (file)
@@ -27,9 +27,10 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
 
     $aPlace['lat'] = $aPointDetails['lat'];
     $aPlace['lon'] = $aPointDetails['lon'];
+
     $aPlace['display_name'] = $aPointDetails['name'];
 
-    if ($sOutputFormat == 'jsonv2') {
+    if ($sOutputFormat == 'jsonv2' || $sOutputFormat == 'geojson') {
         $aPlace['place_rank'] = $aPointDetails['rank_search'];
         $aPlace['category'] = $aPointDetails['class'];
     } else {
@@ -43,8 +44,8 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
         $aPlace['icon'] = $aPointDetails['icon'];
     }
 
-    if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])) {
-        $aPlace['address'] = $aPointDetails['address'];
+    if (isset($aPointDetails['address'])) {
+        $aPlace['address'] = $aPointDetails['address']->getAddressNames();
     }
 
     if (isset($aPointDetails['asgeojson'])) {