2 header('content-type: application/json; charset=UTF-8');
4 $aFilteredPlaces = array();
5 foreach ($aSearchResults as $iResNum => $aPointDetails) {
7 'place_id'=>$aPointDetails['place_id'],
8 'licence'=>'Data © OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright',
11 $sOSMType = formatOSMType($aPointDetails['osm_type']);
13 $aPlace['osm_type'] = $sOSMType;
14 $aPlace['osm_id'] = $aPointDetails['osm_id'];
17 if (isset($aPointDetails['aBoundingBox'])) {
18 $aPlace['boundingbox'] = $aPointDetails['aBoundingBox'];
20 if (isset($aPointDetails['aPolyPoints'])) {
21 $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
25 if (isset($aPointDetails['zoom'])) {
26 $aPlace['zoom'] = $aPointDetails['zoom'];
29 $aPlace['lat'] = $aPointDetails['lat'];
30 $aPlace['lon'] = $aPointDetails['lon'];
31 $aPlace['display_name'] = $aPointDetails['name'];
33 $aPlace['class'] = $aPointDetails['class'];
34 $aPlace['type'] = $aPointDetails['type'];
36 $aPlace['importance'] = $aPointDetails['importance'];
38 if (isset($aPointDetails['icon']) && $aPointDetails['icon']) {
39 $aPlace['icon'] = $aPointDetails['icon'];
42 if (isset($aPointDetails['address'])) {
43 $aPlace['address'] = $aPointDetails['address'];
46 if (isset($aPointDetails['asgeojson'])) {
47 $aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
50 if (isset($aPointDetails['assvg'])) {
51 $aPlace['svg'] = $aPointDetails['assvg'];
54 if (isset($aPointDetails['astext'])) {
55 $aPlace['geotext'] = $aPointDetails['astext'];
58 if (isset($aPointDetails['askml'])) {
59 $aPlace['geokml'] = $aPointDetails['askml'];
62 if (isset($aPointDetails['sExtraTags'])) $aPlace['extratags'] = $aPointDetails['sExtraTags'];
63 if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
65 $aFilteredPlaces[] = $aPlace;
68 javascript_renderData($aFilteredPlaces);