2 header("content-type: application/json; charset=UTF-8");
4 $aFilteredPlaces = array();
5 foreach($aSearchResults as $iResNum => $aPointDetails)
8 'place_id'=>$aPointDetails['place_id'],
9 'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
12 $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':($aPointDetails['osm_type'] == 'T'?'tiger':''))));
15 $aPlace['osm_type'] = $sOSMType;
16 $aPlace['osm_id'] = $aPointDetails['osm_id'];
19 if (isset($aPointDetails['aBoundingBox']))
21 $aPlace['boundingbox'] = array(
22 $aPointDetails['aBoundingBox'][0],
23 $aPointDetails['aBoundingBox'][1],
24 $aPointDetails['aBoundingBox'][2],
25 $aPointDetails['aBoundingBox'][3]);
27 if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
29 $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
33 if (isset($aPointDetails['zoom']))
35 $aPlace['zoom'] = $aPointDetails['zoom'];
38 $aPlace['lat'] = $aPointDetails['lat'];
39 $aPlace['lon'] = $aPointDetails['lon'];
40 $aPlace['display_name'] = $aPointDetails['name'];
42 $aPlace['class'] = $aPointDetails['class'];
43 $aPlace['type'] = $aPointDetails['type'];
45 $aPlace['importance'] = $aPointDetails['importance'];
47 if (isset($aPointDetails['icon']) && $aPointDetails['icon'])
49 $aPlace['icon'] = $aPointDetails['icon'];
52 if (isset($aPointDetails['address']))
54 $aPlace['address'] = $aPointDetails['address'];
57 if (isset($aPointDetails['asgeojson']))
59 $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
62 if (isset($aPointDetails['assvg']))
64 $aPlace['svg'] = $aPointDetails['assvg'];
67 if (isset($aPointDetails['astext']))
69 $aPlace['geotext'] = $aPointDetails['astext'];
72 if (isset($aPointDetails['askml']))
74 $aPlace['geokml'] = $aPointDetails['askml'];
77 if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags'];
78 if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
80 $aFilteredPlaces[] = $aPlace;
83 javascript_renderData($aFilteredPlaces);