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'])) $aFilteredPlaces['properties']['place_id'] = $aPlace['place_id'];
19 $sOSMType = formatOSMType($aPlace['osm_type']);
21 $aFilteredPlaces['properties']['osm_type'] = $sOSMType;
22 $aFilteredPlaces['properties']['osm_id'] = $aPlace['osm_id'];
25 $aFilteredPlaces['properties']['place_rank'] = $aPlace['rank_search'];
27 $aFilteredPlaces['properties']['category'] = $aPlace['class'];
28 $aFilteredPlaces['properties']['type'] = $aPlace['type'];
30 $aFilteredPlaces['properties']['importance'] = $aPlace['importance'];
32 $aFilteredPlaces['properties']['addresstype'] = strtolower($aPlace['addresstype']);
34 $aFilteredPlaces['properties']['name'] = $aPlace['placename'];
36 $aFilteredPlaces['properties']['display_name'] = $aPlace['langaddress'];
38 if (isset($aPlace['address'])) {
39 $aFilteredPlaces['properties']['address'] = $aPlace['address']->getAddressNames();
41 if (isset($aPlace['sExtraTags'])) {
42 $aFilteredPlaces['properties']['extratags'] = $aPlace['sExtraTags'];
44 if (isset($aPlace['sNameDetails'])) {
45 $aFilteredPlaces['properties']['namedetails'] = $aPlace['sNameDetails'];
48 if (isset($aPlace['aBoundingBox'])) {
49 $aFilteredPlaces['bbox'] = array(
50 (float) $aPlace['aBoundingBox'][2], // minlon
51 (float) $aPlace['aBoundingBox'][0], // minlat
52 (float) $aPlace['aBoundingBox'][3], // maxlon
53 (float) $aPlace['aBoundingBox'][1] // maxlat
57 if (isset($aPlace['asgeojson'])) {
58 $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']);
60 $aFilteredPlaces['geometry'] = array(
62 'coordinates' => array(
63 (float) $aPlace['lon'],
64 (float) $aPlace['lat']
70 javascript_renderData(array(
71 'type' => 'FeatureCollection',
72 'licence' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
73 'features' => array($aFilteredPlaces)