3 $aFilteredPlaces = array();
4 foreach ($aSearchResults as $iResNum => $aPointDetails) {
12 if (isset($aPointDetails['place_id'])) {
13 $aPlace['properties']['geocoding']['place_id'] = $aPointDetails['place_id'];
15 $sOSMType = formatOSMType($aPointDetails['osm_type']);
17 $aPlace['properties']['geocoding']['osm_type'] = $sOSMType;
18 $aPlace['properties']['geocoding']['osm_id'] = $aPointDetails['osm_id'];
21 $aPlace['properties']['geocoding']['type'] = $aPointDetails['type'];
23 $aPlace['properties']['geocoding']['label'] = $aPointDetails['langaddress'];
25 if ($aPointDetails['placename'] !== null) {
26 $aPlace['properties']['geocoding']['name'] = $aPointDetails['placename'];
29 if (isset($aPointDetails['address'])) {
30 $aPointDetails['address']->addGeocodeJsonAddressParts(
31 $aPlace['properties']['geocoding']
34 $aPlace['properties']['geocoding']['admin']
35 = $aPointDetails['address']->getAdminLevels();
38 if (isset($aPointDetails['asgeojson'])) {
39 $aPlace['geometry'] = json_decode($aPointDetails['asgeojson']);
41 $aPlace['geometry'] = array(
43 'coordinates' => array(
44 (float) $aPointDetails['lon'],
45 (float) $aPointDetails['lat']
49 $aFilteredPlaces[] = $aPlace;
53 javascript_renderData(array(
54 'type' => 'FeatureCollection',
57 'attribution' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
61 'features' => $aFilteredPlaces