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) {
 
  15                'properties' => array(
 
  16                                 'place_id'=>$aPointDetails['place_id'],
 
  20     $sOSMType = formatOSMType($aPointDetails['osm_type']);
 
  22         $aPlace['properties']['osm_type'] = $sOSMType;
 
  23         $aPlace['properties']['osm_id'] = $aPointDetails['osm_id'];
 
  26     if (isset($aPointDetails['aBoundingBox'])) {
 
  27         $aPlace['bbox'] = array(
 
  28                            (float) $aPointDetails['aBoundingBox'][2], // minlon
 
  29                            (float) $aPointDetails['aBoundingBox'][0], // minlat
 
  30                            (float) $aPointDetails['aBoundingBox'][3], // maxlon
 
  31                            (float) $aPointDetails['aBoundingBox'][1]  // maxlat
 
  35     if (isset($aPointDetails['zoom'])) {
 
  36         $aPlace['properties']['zoom'] = $aPointDetails['zoom'];
 
  39     $aPlace['properties']['display_name'] = $aPointDetails['name'];
 
  41     $aPlace['properties']['place_rank'] = $aPointDetails['rank_search'];
 
  42     $aPlace['properties']['category'] = $aPointDetails['class'];
 
  44     $aPlace['properties']['type'] = $aPointDetails['type'];
 
  46     $aPlace['properties']['importance'] = $aPointDetails['importance'];
 
  48     if (isset($aPointDetails['icon']) && $aPointDetails['icon']) {
 
  49         $aPlace['properties']['icon'] = $aPointDetails['icon'];
 
  52     if (isset($aPointDetails['address'])) {
 
  53         $aPlace['properties']['address'] = $aPointDetails['address']->getAddressNames();
 
  56     if (isset($aPointDetails['asgeojson'])) {
 
  57         $aPlace['geometry'] = json_decode($aPointDetails['asgeojson']);
 
  59         $aPlace['geometry'] = array(
 
  61                                'coordinates' => array(
 
  62                                                  (float) $aPointDetails['lon'],
 
  63                                                  (float) $aPointDetails['lat']
 
  69     if (isset($aPointDetails['sExtraTags'])) {
 
  70         $aPlace['properties']['extratags'] = $aPointDetails['sExtraTags'];
 
  72     if (isset($aPointDetails['sNameDetails'])) {
 
  73         $aPlace['properties']['namedetails'] = $aPointDetails['sNameDetails'];
 
  76     $aFilteredPlaces[] = $aPlace;
 
  79 javascript_renderData(array(
 
  80                        'type' => 'FeatureCollection',
 
  81                        'licence' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
 
  82                        'features' => $aFilteredPlaces