]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/search-json.php
fix json output of empty arrays
[nominatim.git] / lib / template / search-json.php
index 4eed52ae122490f8f8d0abbf2bdb6c16d15d12a0..3dcaabdbd6393a94bc27b375c1c401db11626a69 100644 (file)
@@ -1,10 +1,12 @@
 <?php
 <?php
+       header("content-type: application/json; charset=UTF-8");
+
        $aFilteredPlaces = array();
        foreach($aSearchResults as $iResNum => $aPointDetails)
        {
                $aPlace = array(
                                'place_id'=>$aPointDetails['place_id'],
        $aFilteredPlaces = array();
        foreach($aSearchResults as $iResNum => $aPointDetails)
        {
                $aPlace = array(
                                'place_id'=>$aPointDetails['place_id'],
-                               'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
+                               'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
                        );
 
                $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
                        );
 
                $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
 
                $aPlace['class'] = $aPointDetails['class'];
                $aPlace['type'] = $aPointDetails['type'];
 
                $aPlace['class'] = $aPointDetails['class'];
                $aPlace['type'] = $aPointDetails['type'];
-               if ($aPointDetails['icon'])
+
+               $aPlace['importance'] = $aPointDetails['importance'];
+
+               if (isset($aPointDetails['icon']) && $aPointDetails['icon'])
                {
                        $aPlace['icon'] = $aPointDetails['icon'];
                }
                {
                        $aPlace['icon'] = $aPointDetails['icon'];
                }
                        $aPlace['address'] = $aPointDetails['address'];
                 }
 
                        $aPlace['address'] = $aPointDetails['address'];
                 }
 
+                if (isset($aPointDetails['asgeojson']))
+                {
+                        $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
+                }
+
+                if (isset($aPointDetails['assvg']))
+                {
+                        $aPlace['svg'] = $aPointDetails['assvg'];
+                }
+
+                if (isset($aPointDetails['astext']))
+                {
+                        $aPlace['geotext'] = $aPointDetails['astext'];
+                }
+
+               if (isset($aPointDetails['askml']))
+               {
+                       $aPlace['geokml'] = $aPointDetails['askml'];
+               }
+
+               if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags'];
+               if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
+
                $aFilteredPlaces[] = $aPlace;
        }
 
                $aFilteredPlaces[] = $aPlace;
        }