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                                 'geocoding' => array()
 
  20     if (isset($aPointDetails['place_id'])) {
 
  21         $aPlace['properties']['geocoding']['place_id'] = $aPointDetails['place_id'];
 
  23     $sOSMType = formatOSMType($aPointDetails['osm_type']);
 
  25         $aPlace['properties']['geocoding']['osm_type'] = $sOSMType;
 
  26         $aPlace['properties']['geocoding']['osm_id'] = $aPointDetails['osm_id'];
 
  29     $aPlace['properties']['geocoding']['type'] = $aPointDetails['type'];
 
  31     $aPlace['properties']['geocoding']['label'] = $aPointDetails['langaddress'];
 
  33     if ($aPointDetails['placename'] !== null) {
 
  34         $aPlace['properties']['geocoding']['name'] = $aPointDetails['placename'];
 
  37     if (isset($aPointDetails['address'])) {
 
  38         $aPointDetails['address']->addGeocodeJsonAddressParts(
 
  39             $aPlace['properties']['geocoding']
 
  42         $aPlace['properties']['geocoding']['admin']
 
  43             = $aPointDetails['address']->getAdminLevels();
 
  46     if (isset($aPointDetails['asgeojson'])) {
 
  47         $aPlace['geometry'] = json_decode($aPointDetails['asgeojson']);
 
  49         $aPlace['geometry'] = array(
 
  51                                'coordinates' => array(
 
  52                                                  (float) $aPointDetails['lon'],
 
  53                                                  (float) $aPointDetails['lat']
 
  57     $aFilteredPlaces[] = $aPlace;
 
  61 javascript_renderData(array(
 
  62                        'type' => 'FeatureCollection',
 
  65                                        'attribution' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
 
  69                        'features' => $aFilteredPlaces