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.
12 $aOutput['licence'] = 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright';
13 $aOutput['batch'] = array();
15 foreach ($aBatchResults as $aSearchResults) {
16 if (!$aSearchResults) {
17 $aSearchResults = array();
19 $aFilteredPlaces = array();
20 foreach ($aSearchResults as $iResNum => $aPointDetails) {
22 'place_id'=>$aPointDetails['place_id'],
25 $sOSMType = formatOSMType($aPointDetails['osm_type']);
27 $aPlace['osm_type'] = $sOSMType;
28 $aPlace['osm_id'] = $aPointDetails['osm_id'];
31 if (isset($aPointDetails['aBoundingBox'])) {
32 $aPlace['boundingbox'] = array(
33 $aPointDetails['aBoundingBox'][0],
34 $aPointDetails['aBoundingBox'][1],
35 $aPointDetails['aBoundingBox'][2],
36 $aPointDetails['aBoundingBox'][3]
40 if (isset($aPointDetails['zoom'])) {
41 $aPlace['zoom'] = $aPointDetails['zoom'];
44 $aPlace['lat'] = $aPointDetails['lat'];
45 $aPlace['lon'] = $aPointDetails['lon'];
46 $aPlace['display_name'] = $aPointDetails['name'];
47 $aPlace['place_rank'] = $aPointDetails['rank_search'];
49 $aPlace['category'] = $aPointDetails['class'];
50 $aPlace['type'] = $aPointDetails['type'];
52 $aPlace['importance'] = $aPointDetails['importance'];
54 if (isset($aPointDetails['icon'])) {
55 $aPlace['icon'] = $aPointDetails['icon'];
58 if (isset($aPointDetails['address'])) {
59 $aPlace['address'] = $aPointDetails['address']->getAddressNames();
62 if (isset($aPointDetails['asgeojson'])) {
63 $aPlace['geojson'] = json_decode($aPointDetails['asgeojson'], true);
66 if (isset($aPointDetails['assvg'])) {
67 $aPlace['svg'] = $aPointDetails['assvg'];
70 if (isset($aPointDetails['astext'])) {
71 $aPlace['geotext'] = $aPointDetails['astext'];
74 if (isset($aPointDetails['askml'])) {
75 $aPlace['geokml'] = $aPointDetails['askml'];
78 $aFilteredPlaces[] = $aPlace;
80 $aOutput['batch'][] = $aFilteredPlaces;
83 javascript_renderData($aOutput, array('geojson'));