]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-jsonv2.php
remove now unnecessary DOCS comments in vagrant script
[nominatim.git] / lib / template / search-jsonv2.php
1 <?php
2
3 $aFilteredPlaces = array();
4 foreach ($aSearchResults as $iResNum => $aPointDetails) {
5     $aPlace = array(
6                'place_id'=>$aPointDetails['place_id'],
7                'licence'=>'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
8               );
9
10     $sOSMType = formatOSMType($aPointDetails['osm_type']);
11     if ($sOSMType) {
12         $aPlace['osm_type'] = $sOSMType;
13         $aPlace['osm_id'] = $aPointDetails['osm_id'];
14     }
15
16     if (isset($aPointDetails['aBoundingBox'])) {
17         $aPlace['boundingbox'] = $aPointDetails['aBoundingBox'];
18
19         if (isset($aPointDetails['aPolyPoints'])) {
20             $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
21         }
22     }
23
24     if (isset($aPointDetails['zoom'])) {
25         $aPlace['zoom'] = $aPointDetails['zoom'];
26     }
27
28     $aPlace['lat'] = $aPointDetails['lat'];
29     $aPlace['lon'] = $aPointDetails['lon'];
30     $aPlace['display_name'] = $aPointDetails['name'];
31     $aPlace['place_rank'] = $aPointDetails['rank_search'];
32
33     $aPlace['category'] = $aPointDetails['class'];
34     $aPlace['type'] = $aPointDetails['type'];
35
36     $aPlace['importance'] = $aPointDetails['importance'];
37
38     if (isset($aPointDetails['icon'])) {
39         $aPlace['icon'] = $aPointDetails['icon'];
40     }
41
42     if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0) {
43         $aPlace['address'] = $aPointDetails['address'];
44     }
45
46     if (isset($aPointDetails['asgeojson'])) {
47         $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
48     }
49
50     if (isset($aPointDetails['assvg'])) {
51         $aPlace['svg'] = $aPointDetails['assvg'];
52     }
53
54     if (isset($aPointDetails['astext'])) {
55         $aPlace['geotext'] = $aPointDetails['astext'];
56     }
57
58     if (isset($aPointDetails['askml'])) {
59         $aPlace['geokml'] = $aPointDetails['askml'];
60     }
61
62     if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags'];
63     if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
64
65     $aFilteredPlaces[] = $aPlace;
66 }
67
68 javascript_renderData($aFilteredPlaces);