]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-json.php
details support json output
[nominatim.git] / lib / template / details-json.php
1 <?php
2
3 $aPlaceDetails = $aPointDetails;
4
5 $aPlaceDetails['geojson'] = json_decode($aPointDetails['asgeojson']);
6 unset($aPlaceDetails['asgeojson']);
7
8 if ($aAddressLines) {
9     $aPlaceDetails['address_lines'] = $aAddressLines;
10 }
11
12 if ($aLinkedLines) {
13     $aPlaceDetails['linked_lines'] = $aLinkedLines;
14 }
15
16 if ($aPlaceSearchNameKeywords) {
17     $aPlaceDetails['place_search_name_keywords'] = $aPlaceSearchNameKeywords;
18 }
19
20 if ($aPlaceSearchAddressKeywords) {
21     $aPlaceDetails['place_search_address_keywords'] = $aPlaceSearchAddressKeywords;
22 }
23
24 if ($aParentOfLines) {
25     $aPlaceDetails['parentof_lines'] = $aParentOfLines;
26
27     if ($bGroupParents) {
28         $aGroupedAddressLines = [];
29         foreach ($aParentOfLines as $aAddressLine) {
30             if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
31             else $sType = $aAddressLine['type'];
32
33             if (!isset($aGroupedAddressLines[$sType]))
34                 $aGroupedAddressLines[$sType] = [];
35             $aGroupedAddressLines[$sType][] = $aAddressLine;
36         }
37         $aPlaceDetails['parentof_lines'] = $aGroupedAddressLines;
38     }
39 }
40
41 javascript_renderData($aPlaceDetails);