3 $aFilteredPlaces = array();
4 foreach ($aSearchResults as $iResNum => $aPointDetails) {
8 'place_id'=>$aPointDetails['place_id'],
12 $sOSMType = formatOSMType($aPointDetails['osm_type']);
14 $aPlace['properties']['osm_type'] = $sOSMType;
15 $aPlace['properties']['osm_id'] = $aPointDetails['osm_id'];
18 if (isset($aPointDetails['aBoundingBox'])) {
19 $aPlace['bbox'] = array(
20 (float) $aPointDetails['aBoundingBox'][2], // minlon
21 (float) $aPointDetails['aBoundingBox'][0], // minlat
22 (float) $aPointDetails['aBoundingBox'][3], // maxlon
23 (float) $aPointDetails['aBoundingBox'][1] // maxlat
27 if (isset($aPointDetails['zoom'])) {
28 $aPlace['properties']['zoom'] = $aPointDetails['zoom'];
31 $aPlace['properties']['display_name'] = $aPointDetails['name'];
33 $aPlace['properties']['place_rank'] = $aPointDetails['rank_search'];
34 $aPlace['properties']['category'] = $aPointDetails['class'];
36 $aPlace['properties']['type'] = $aPointDetails['type'];
38 $aPlace['properties']['importance'] = $aPointDetails['importance'];
40 if (isset($aPointDetails['icon']) && $aPointDetails['icon']) {
41 $aPlace['properties']['icon'] = $aPointDetails['icon'];
44 if (isset($aPointDetails['address'])) {
45 $aPlace['properties']['address'] = $aPointDetails['address']->getAddressNames();
48 if (isset($aPointDetails['asgeojson'])) {
49 $aPlace['geometry'] = json_decode($aPointDetails['asgeojson']);
51 $aPlace['geometry'] = array(
53 'coordinates' => array(
54 (float) $aPointDetails['lon'],
55 (float) $aPointDetails['lat']
61 if (isset($aPointDetails['sExtraTags'])) $aPlace['properties']['extratags'] = $aPointDetails['sExtraTags'];
62 if (isset($aPointDetails['sNameDetails'])) $aPlace['properties']['namedetails'] = $aPointDetails['sNameDetails'];
64 $aFilteredPlaces[] = $aPlace;
67 javascript_renderData(array(
68 'type' => 'FeatureCollection',
69 'licence' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
70 'features' => $aFilteredPlaces