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':'')));
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'];
44 if (isset($aPointDetails['icon']) && $aPointDetails['icon'])
46 $aPlace['icon'] = $aPointDetails['icon'];
49 if (isset($aPointDetails['address']))
51 $aPlace['address'] = $aPointDetails['address'];
54 if (isset($aResult['asgeojson']))
56 $aPlace['geojson'] = json_decode($aResult['asgeojson']);
59 if (isset($aResult['assvg']))
61 $aPlace['svg'] = $aResult['assvg'];
64 if (isset($aResult['astext']))
66 $aPlace['geotext'] = $aResult['astext'];
69 if (isset($aResult['askml']))
71 $aPlace['geokml'] = $aResult['askml'];
74 $aFilteredPlaces[] = $aPlace;
77 javascript_renderData($aFilteredPlaces);