3 $aPlaceDetails = array();
5 $aPlaceDetails['place_id'] = (int) $aPointDetails['place_id'];
6 $aPlaceDetails['parent_place_id'] = (int) $aPointDetails['parent_place_id'];
8 $aPlaceDetails['osm_type'] = $aPointDetails['osm_type'];
9 $aPlaceDetails['osm_id'] = (int) $aPointDetails['osm_id'];
11 $aPlaceDetails['category'] = $aPointDetails['class'];
12 $aPlaceDetails['type'] = $aPointDetails['type'];
13 $aPlaceDetails['admin_level'] = $aPointDetails['admin_level'];
15 $aPlaceDetails['names'] = $aPointDetails['aNames'];
17 $aPlaceDetails['addresstags'] = $aPointDetails['aAddressTags'];
18 $aPlaceDetails['housenumber'] = $aPointDetails['housenumber'];
19 $aPlaceDetails['postcode'] = $aPointDetails['postcode']; // computed
20 $aPlaceDetails['country_code'] = $aPointDetails['country_code'];
22 $aPlaceDetails['indexed_date'] = $aPointDetails['indexed_date'];
23 $aPlaceDetails['importance'] = (float) $aPointDetails['importance'];
24 $aPlaceDetails['calculated_importance'] = (float) $aPointDetails['calculated_importance'];
26 $aPlaceDetails['extratags'] = $aPointDetails['aExtraTags'];
27 $aPlaceDetails['calculated_wikipedia'] = $aPointDetails['wikipedia'];
28 $aPlaceDetails['icon'] = $aPointDetails['icon'];
30 $aPlaceDetails['rank_address'] = (int) $aPointDetails['rank_address'];
31 $aPlaceDetails['rank_search'] = (int) $aPointDetails['rank_search'];
32 $aPlaceDetails['rank_search_label'] = $aPointDetails['rank_search_label'];
34 $aPlaceDetails['isarea'] = ($aPointDetails['isarea'] == 't');
35 $aPlaceDetails['lat'] = (float) $aPointDetails['lat'];
36 $aPlaceDetails['lon'] = (float) $aPointDetails['lon'];
39 $aPlaceDetails['geometry'] = json_decode($aPointDetails['asgeojson']);
41 $funcMapAddressLines = function ($aFull) {
43 'localname' => $aFull['localname'],
44 'place_id' => (int) $aFull['place_id'],
45 'osm_id' => (int) $aFull['osm_id'],
46 'osm_type' => formatOSMType($aFull['osm_type']),
47 'class' => $aFull['class'],
48 'type' => $aFull['type'],
49 'admin_level' => (int) $aFull['admin_level'],
50 'rank_address' => (int) $aFull['rank_address'],
51 'distance' => (float) $aFull['distance']
56 $funcMapKeywords = function ($aFull) {
58 'id' => (int) $aFull['word_id'],
59 'token' => $aFull['word_token']
65 $aPlaceDetails['address'] = array_map($funcMapAddressLines, $aAddressLines);
69 $aPlaceDetails['linked_places'] = array_map($funcMapAddressLines, $aLinkedLines);
72 if ($bIncludeKeywords) {
73 $aPlaceDetails['keywords'] = array();
75 if ($aPlaceSearchNameKeywords) {
76 $aPlaceDetails['keywords']['name'] = array_map($funcMapKeywords, $aPlaceSearchNameKeywords);
79 if ($aPlaceSearchAddressKeywords) {
80 $aPlaceDetails['keywords']['address'] = array_map($funcMapKeywords, $aPlaceSearchAddressKeywords);
84 if ($bIncludeChildPlaces) {
85 $aPlaceDetails['parentof'] = array_map($funcMapAddressLines, $aParentOfLines);
87 if ($bGroupChildPlaces) {
88 $aGroupedAddressLines = [];
89 foreach ($aParentOfLines as $aAddressLine) {
90 if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
91 else $sType = $aAddressLine['type'];
93 if (!isset($aGroupedAddressLines[$sType]))
94 $aGroupedAddressLines[$sType] = [];
95 $aGroupedAddressLines[$sType][] = $aAddressLine;
97 $aPlaceDetails['parentof'] = $aGroupedAddressLines;
101 javascript_renderData($aPlaceDetails);