3 $aFilteredPlaces = array();
7 $aFilteredPlaces['error'] = $sError;
8 else $aFilteredPlaces['error'] = 'Unable to geocode';
9 javascript_renderData($aFilteredPlaces);
11 $aFilteredPlaces = array(
13 'properties' => array()
16 if (isset($aPlace['place_id'])) $aFilteredPlaces['properties']['place_id'] = $aPlace['place_id'];
17 $sOSMType = formatOSMType($aPlace['osm_type']);
19 $aFilteredPlaces['properties']['osm_type'] = $sOSMType;
20 $aFilteredPlaces['properties']['osm_id'] = $aPlace['osm_id'];
23 $aFilteredPlaces['properties']['place_rank'] = $aPlace['rank_search'];
25 $aFilteredPlaces['properties']['category'] = $aPlace['class'];
26 $aFilteredPlaces['properties']['type'] = $aPlace['type'];
28 $aFilteredPlaces['properties']['importance'] = $aPlace['importance'];
30 $aFilteredPlaces['properties']['addresstype'] = strtolower($aPlace['addresstype']);
32 $aFilteredPlaces['properties']['name'] = $aPlace['placename'];
34 $aFilteredPlaces['properties']['display_name'] = $aPlace['langaddress'];
36 if (isset($aPlace['aAddress'])) $aFilteredPlaces['properties']['address'] = $aPlace['aAddress'];
37 if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['properties']['extratags'] = $aPlace['sExtraTags'];
38 if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['properties']['namedetails'] = $aPlace['sNameDetails'];
40 if (isset($aPlace['aBoundingBox'])) {
41 $aFilteredPlaces['bbox'] = array(
42 (float) $aPlace['aBoundingBox'][2], // minlon
43 (float) $aPlace['aBoundingBox'][0], // minlat
44 (float) $aPlace['aBoundingBox'][3], // maxlon
45 (float) $aPlace['aBoundingBox'][1] // maxlat
49 if (isset($aPlace['asgeojson'])) {
50 $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']);
52 $aFilteredPlaces['geometry'] = array(
54 'coordinates' => array(
55 (float) $aPlace['lon'],
56 (float) $aPlace['lat']
62 javascript_renderData(array(
63 'type' => 'FeatureCollection',
64 'licence' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
65 'features' => array($aFilteredPlaces)