3 * SPDX-License-Identifier: GPL-2.0-only
5 * This file is part of Nominatim. (https://nominatim.org)
7 * Copyright (C) 2022 by the Nominatim developer community.
8 * For a full list of authors see the git log.
11 $aFilteredPlaces = array();
12 foreach ($aSearchResults as $iResNum => $aPointDetails) {
14 'place_id'=>$aPointDetails['place_id'],
15 'licence'=>'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
18 $sOSMType = formatOSMType($aPointDetails['osm_type']);
20 $aPlace['osm_type'] = $sOSMType;
21 $aPlace['osm_id'] = $aPointDetails['osm_id'];
24 if (isset($aPointDetails['aBoundingBox'])) {
25 $aPlace['boundingbox'] = $aPointDetails['aBoundingBox'];
28 if (isset($aPointDetails['zoom'])) {
29 $aPlace['zoom'] = $aPointDetails['zoom'];
32 $aPlace['lat'] = $aPointDetails['lat'];
33 $aPlace['lon'] = $aPointDetails['lon'];
35 $aPlace['display_name'] = $aPointDetails['name'];
37 if ($sOutputFormat == 'jsonv2' || $sOutputFormat == 'geojson') {
38 $aPlace['place_rank'] = $aPointDetails['rank_search'];
39 $aPlace['category'] = $aPointDetails['class'];
41 $aPlace['class'] = $aPointDetails['class'];
43 $aPlace['type'] = $aPointDetails['type'];
45 $aPlace['importance'] = $aPointDetails['importance'];
47 if (isset($aPointDetails['icon']) && $aPointDetails['icon']) {
48 $aPlace['icon'] = $aPointDetails['icon'];
51 if (isset($aPointDetails['address'])) {
52 $aPlace['address'] = $aPointDetails['address']->getAddressNames();
55 if (isset($aPointDetails['asgeojson'])) {
56 $aPlace['geojson'] = json_decode($aPointDetails['asgeojson'], true);
59 if (isset($aPointDetails['assvg'])) {
60 $aPlace['svg'] = $aPointDetails['assvg'];
63 if (isset($aPointDetails['astext'])) {
64 $aPlace['geotext'] = $aPointDetails['astext'];
67 if (isset($aPointDetails['askml'])) {
68 $aPlace['geokml'] = $aPointDetails['askml'];
71 if (isset($aPointDetails['sExtraTags'])) {
72 $aPlace['extratags'] = $aPointDetails['sExtraTags'];
74 if (isset($aPointDetails['sNameDetails'])) {
75 $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
78 $aFilteredPlaces[] = $aPlace;
81 javascript_renderData($aFilteredPlaces);