3 $aFilteredPlaces = array();
7 $aFilteredPlaces['error'] = $sError;
9 $aFilteredPlaces['error'] = 'Unable to geocode';
11 javascript_renderData($aFilteredPlaces);
13 $aFilteredPlaces = array(
15 'properties' => array()
18 if (isset($aPlace['place_id'])) {
19 $aFilteredPlaces['properties']['place_id'] = $aPlace['place_id'];
21 $sOSMType = formatOSMType($aPlace['osm_type']);
23 $aFilteredPlaces['properties']['osm_type'] = $sOSMType;
24 $aFilteredPlaces['properties']['osm_id'] = $aPlace['osm_id'];
27 $aFilteredPlaces['properties']['place_rank'] = $aPlace['rank_search'];
29 $aFilteredPlaces['properties']['category'] = $aPlace['class'];
30 $aFilteredPlaces['properties']['type'] = $aPlace['type'];
32 $aFilteredPlaces['properties']['importance'] = $aPlace['importance'];
34 $aFilteredPlaces['properties']['addresstype'] = strtolower($aPlace['addresstype']);
36 $aFilteredPlaces['properties']['name'] = $aPlace['placename'];
38 $aFilteredPlaces['properties']['display_name'] = $aPlace['langaddress'];
40 if (isset($aPlace['address'])) {
41 $aFilteredPlaces['properties']['address'] = $aPlace['address']->getAddressNames();
43 if (isset($aPlace['sExtraTags'])) {
44 $aFilteredPlaces['properties']['extratags'] = $aPlace['sExtraTags'];
46 if (isset($aPlace['sNameDetails'])) {
47 $aFilteredPlaces['properties']['namedetails'] = $aPlace['sNameDetails'];
50 if (isset($aPlace['aBoundingBox'])) {
51 $aFilteredPlaces['bbox'] = array(
52 (float) $aPlace['aBoundingBox'][2], // minlon
53 (float) $aPlace['aBoundingBox'][0], // minlat
54 (float) $aPlace['aBoundingBox'][3], // maxlon
55 (float) $aPlace['aBoundingBox'][1] // maxlat
59 if (isset($aPlace['asgeojson'])) {
60 $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']);
62 $aFilteredPlaces['geometry'] = array(
64 'coordinates' => array(
65 (float) $aPlace['lon'],
66 (float) $aPlace['lat']
72 javascript_renderData(array(
73 'type' => 'FeatureCollection',
74 'licence' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
75 'features' => array($aFilteredPlaces)