]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-json.php
phpcs fixes. Mostly spacing and single quotes
[nominatim.git] / lib / template / search-json.php
1 <?php
2 header('content-type: application/json; charset=UTF-8');
3
4 $aFilteredPlaces = array();
5 foreach ($aSearchResults as $iResNum => $aPointDetails) {
6     $aPlace = array(
7                'place_id'=>$aPointDetails['place_id'],
8                'licence'=>'Data © OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright',
9               );
10     
11     $sOSMType = formatOSMType($aPointDetails['osm_type']);
12     if ($sOSMType) {
13         $aPlace['osm_type'] = $sOSMType;
14         $aPlace['osm_id'] = $aPointDetails['osm_id'];
15     }
16
17     if (isset($aPointDetails['aBoundingBox'])) {
18         $aPlace['boundingbox'] = $aPointDetails['aBoundingBox'];
19
20         if (isset($aPointDetails['aPolyPoints'])) {
21             $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
22         }
23     }
24
25     if (isset($aPointDetails['zoom'])) {
26         $aPlace['zoom'] = $aPointDetails['zoom'];
27     }
28
29     $aPlace['lat'] = $aPointDetails['lat'];
30     $aPlace['lon'] = $aPointDetails['lon'];
31     $aPlace['display_name'] = $aPointDetails['name'];
32
33     $aPlace['class'] = $aPointDetails['class'];
34     $aPlace['type'] = $aPointDetails['type'];
35
36     $aPlace['importance'] = $aPointDetails['importance'];
37
38     if (isset($aPointDetails['icon']) && $aPointDetails['icon']) {
39         $aPlace['icon'] = $aPointDetails['icon'];
40     }
41
42     if (isset($aPointDetails['address'])) {
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);