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['address'])) {
37 $aFilteredPlaces['properties']['address'] = $aPlace['address']->getAddressNames();
39 if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['properties']['extratags'] = $aPlace['sExtraTags'];
40 if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['properties']['namedetails'] = $aPlace['sNameDetails'];
42 if (isset($aPlace['aBoundingBox'])) {
43 $aFilteredPlaces['bbox'] = array(
44 (float) $aPlace['aBoundingBox'][2], // minlon
45 (float) $aPlace['aBoundingBox'][0], // minlat
46 (float) $aPlace['aBoundingBox'][3], // maxlon
47 (float) $aPlace['aBoundingBox'][1] // maxlat
51 if (isset($aPlace['asgeojson'])) {
52 $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']);
54 $aFilteredPlaces['geometry'] = array(
56 'coordinates' => array(
57 (float) $aPlace['lon'],
58 (float) $aPlace['lat']
64 javascript_renderData(array(
65 'type' => 'FeatureCollection',
66 'licence' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
67 'features' => array($aFilteredPlaces)