mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
details support json output
This commit is contained in:
committed by
Sarah Hoffmann
parent
3cdbcbff8f
commit
1e28f2478c
41
lib/template/details-json.php
Normal file
41
lib/template/details-json.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
$aPlaceDetails = $aPointDetails;
|
||||
|
||||
$aPlaceDetails['geojson'] = json_decode($aPointDetails['asgeojson']);
|
||||
unset($aPlaceDetails['asgeojson']);
|
||||
|
||||
if ($aAddressLines) {
|
||||
$aPlaceDetails['address_lines'] = $aAddressLines;
|
||||
}
|
||||
|
||||
if ($aLinkedLines) {
|
||||
$aPlaceDetails['linked_lines'] = $aLinkedLines;
|
||||
}
|
||||
|
||||
if ($aPlaceSearchNameKeywords) {
|
||||
$aPlaceDetails['place_search_name_keywords'] = $aPlaceSearchNameKeywords;
|
||||
}
|
||||
|
||||
if ($aPlaceSearchAddressKeywords) {
|
||||
$aPlaceDetails['place_search_address_keywords'] = $aPlaceSearchAddressKeywords;
|
||||
}
|
||||
|
||||
if ($aParentOfLines) {
|
||||
$aPlaceDetails['parentof_lines'] = $aParentOfLines;
|
||||
|
||||
if ($bGroupParents) {
|
||||
$aGroupedAddressLines = [];
|
||||
foreach ($aParentOfLines as $aAddressLine) {
|
||||
if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
|
||||
else $sType = $aAddressLine['type'];
|
||||
|
||||
if (!isset($aGroupedAddressLines[$sType]))
|
||||
$aGroupedAddressLines[$sType] = [];
|
||||
$aGroupedAddressLines[$sType][] = $aAddressLine;
|
||||
}
|
||||
$aPlaceDetails['parentof_lines'] = $aGroupedAddressLines;
|
||||
}
|
||||
}
|
||||
|
||||
javascript_renderData($aPlaceDetails);
|
||||
Reference in New Issue
Block a user