3 $aFilteredPlaces = array();
4 foreach ($aSearchResults as $iResNum => $aPointDetails) {
12 if (isset($aPlace['place_id'])) $aPlace['properties']['geocoding']['place_id'] = $aPointDetails['place_id'];
13 $sOSMType = formatOSMType($aPlace['osm_type']);
15 $aPlace['properties']['geocoding']['osm_type'] = $sOSMType;
16 $aPlace['properties']['geocoding']['osm_id'] = $aPointDetails['osm_id'];
19 $aPlace['properties']['geocoding']['type'] = $aPointDetails['type'];
21 $aPlace['properties']['geocoding']['label'] = $aPointDetails['langaddress'];
23 $aPlace['properties']['geocoding']['name'] = $aPointDetails['placename'];
25 $aFieldMappings = array(
26 'house_number' => 'housenumber',
28 'locality' => 'locality',
29 'postcode' => 'postcode',
31 'district' => 'district',
34 'country' => 'country'
37 foreach ($aFieldMappings as $sFrom => $sTo) {
38 if (isset($aPointDetails['aAddress'][$sFrom])) {
39 $aPlace['properties']['geocoding'][$sTo] = $aPointDetails['aAddress'][$sFrom];
43 $aPlace['properties']['geocoding']['admin'] = $aPointDetails['aAddressAdminLevels'];
45 if (isset($aPointDetails['asgeojson'])) {
46 $aPlace['geometry'] = json_decode($aPointDetails['asgeojson']);
48 $aPlace['geometry'] = array(
50 'coordinates' => array(
51 (float) $aPointDetails['lon'],
52 (float) $aPointDetails['lat']
56 $aFilteredPlaces[] = $aPlace;
60 javascript_renderData(array(
61 'type' => 'FeatureCollection',
64 'attribution' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
68 'features' => $aFilteredPlaces