]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-jsonv2.php
add osm_type='tiger' to json, jsonv2 and xml output
[nominatim.git] / lib / template / search-jsonv2.php
1 <?php
2         $aFilteredPlaces = array();
3         foreach($aSearchResults as $iResNum => $aPointDetails)
4         {
5                 $aPlace = array(
6                                 'place_id'=>$aPointDetails['place_id'],
7                                 'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
8                         );
9
10                 $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':($aPointDetails['osm_type'] == 'T'?'tiger':''))));
11                 if ($sOSMType)
12                 {
13                         $aPlace['osm_type'] = $sOSMType;
14                         $aPlace['osm_id'] = $aPointDetails['osm_id'];
15                 }
16
17                 if (isset($aPointDetails['aBoundingBox']))
18                 {
19                         $aPlace['boundingbox'] = $aPointDetails['aBoundingBox'];
20
21                         if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
22                         {
23                                 $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
24                         }
25                 }
26
27                 if (isset($aPointDetails['zoom']))
28                 {
29                         $aPlace['zoom'] = $aPointDetails['zoom'];
30                 }
31
32                 $aPlace['lat'] = $aPointDetails['lat'];
33                 $aPlace['lon'] = $aPointDetails['lon'];
34                 $aPlace['display_name'] = $aPointDetails['name'];
35                 $aPlace['place_rank'] = $aPointDetails['rank_search'];
36
37                 $aPlace['category'] = $aPointDetails['class'];
38                 $aPlace['type'] = $aPointDetails['type'];
39
40                 $aPlace['importance'] = $aPointDetails['importance'];
41
42                 if (isset($aPointDetails['icon']))
43                 {
44                         $aPlace['icon'] = $aPointDetails['icon'];
45                 }
46
47                 if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0)
48                 {
49                         $aPlace['address'] = $aPointDetails['address'];
50                 }
51
52                 if (isset($aPointDetails['asgeojson']))
53                 {
54                         $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
55                 }
56
57                 if (isset($aPointDetails['assvg']))
58                 {
59                         $aPlace['svg'] = $aPointDetails['assvg'];
60                 }
61
62                 if (isset($aPointDetails['astext']))
63                 {
64                         $aPlace['geotext'] = $aPointDetails['astext'];
65                 }
66
67                 if (isset($aPointDetails['askml']))
68                 {
69                         $aPlace['geokml'] = $aPointDetails['askml'];
70                 }
71
72                 if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags'];
73                 if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
74
75                 $aFilteredPlaces[] = $aPlace;
76         }
77
78         javascript_renderData($aFilteredPlaces);