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['localname'] = $aPointDetails['localname'];
16 $aPlaceDetails['names'] = $aPointDetails['aNames'];
18 $aPlaceDetails['addresstags'] = $aPointDetails['aAddressTags'];
19 $aPlaceDetails['housenumber'] = $aPointDetails['housenumber'];
20 $aPlaceDetails['postcode'] = $aPointDetails['postcode']; // computed
21 $aPlaceDetails['country_code'] = $aPointDetails['country_code'];
23 $aPlaceDetails['indexed_date'] = $aPointDetails['indexed_date'];
24 $aPlaceDetails['importance'] = (float) $aPointDetails['importance'];
25 $aPlaceDetails['calculated_importance'] = (float) $aPointDetails['calculated_importance'];
27 $aPlaceDetails['extratags'] = $aPointDetails['aExtraTags'];
28 $aPlaceDetails['calculated_wikipedia'] = $aPointDetails['wikipedia'];
29 $aPlaceDetails['icon'] = $aPointDetails['icon'];
31 $aPlaceDetails['rank_address'] = (int) $aPointDetails['rank_address'];
32 $aPlaceDetails['rank_search'] = (int) $aPointDetails['rank_search'];
33 $aPlaceDetails['rank_search_label'] = $aPointDetails['rank_search_label'];
35 $aPlaceDetails['isarea'] = ($aPointDetails['isarea'] == 't');
36 $aPlaceDetails['lat'] = (float) $aPointDetails['lat'];
37 $aPlaceDetails['lon'] = (float) $aPointDetails['lon'];
40 $aPlaceDetails['geometry'] = json_decode($aPointDetails['asgeojson']);
42 $funcMapAddressLines = function ($aFull) {
44 'localname' => $aFull['localname'],
45 'place_id' => (int) $aFull['place_id'],
46 'osm_id' => (int) $aFull['osm_id'],
47 'osm_type' => formatOSMType($aFull['osm_type']),
48 'class' => $aFull['class'],
49 'type' => $aFull['type'],
50 'admin_level' => (int) $aFull['admin_level'],
51 'rank_address' => (int) $aFull['rank_address'],
52 'distance' => (float) $aFull['distance']
57 $funcMapKeywords = function ($aFull) {
59 'id' => (int) $aFull['word_id'],
60 'token' => $aFull['word_token']
66 $aPlaceDetails['address'] = array_map($funcMapAddressLines, $aAddressLines);
70 $aPlaceDetails['linked_places'] = array_map($funcMapAddressLines, $aLinkedLines);
73 if ($bIncludeKeywords) {
74 $aPlaceDetails['keywords'] = array();
76 if ($aPlaceSearchNameKeywords) {
77 $aPlaceDetails['keywords']['name'] = array_map($funcMapKeywords, $aPlaceSearchNameKeywords);
80 if ($aPlaceSearchAddressKeywords) {
81 $aPlaceDetails['keywords']['address'] = array_map($funcMapKeywords, $aPlaceSearchAddressKeywords);
85 if ($bIncludeChildPlaces) {
86 $aPlaceDetails['parentof'] = array_map($funcMapAddressLines, $aParentOfLines);
88 if ($bGroupChildPlaces) {
89 $aGroupedAddressLines = [];
90 foreach ($aParentOfLines as $aAddressLine) {
91 if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
92 else $sType = $aAddressLine['type'];
94 if (!isset($aGroupedAddressLines[$sType]))
95 $aGroupedAddressLines[$sType] = [];
96 $aGroupedAddressLines[$sType][] = $aAddressLine;
98 $aPlaceDetails['parentof'] = $aGroupedAddressLines;
102 javascript_renderData($aPlaceDetails);