3 // https://github.com/geocoders/geocodejson-spec/
 
   5 $aFilteredPlaces = array();
 
   9         $aFilteredPlaces['error'] = $sError;
 
  11         $aFilteredPlaces['error'] = 'Unable to geocode';
 
  13     javascript_renderData($aFilteredPlaces);
 
  15     $aFilteredPlaces = array(
 
  17                         'properties' => array(
 
  18                                          'geocoding' => array()
 
  22     if (isset($aPlace['place_id'])) {
 
  23         $aFilteredPlaces['properties']['geocoding']['place_id'] = $aPlace['place_id'];
 
  25     $sOSMType = formatOSMType($aPlace['osm_type']);
 
  27         $aFilteredPlaces['properties']['geocoding']['osm_type'] = $sOSMType;
 
  28         $aFilteredPlaces['properties']['geocoding']['osm_id'] = $aPlace['osm_id'];
 
  31     $aFilteredPlaces['properties']['geocoding']['type'] = $aPlace['type'];
 
  33     $aFilteredPlaces['properties']['geocoding']['accuracy'] = (int) $fDistance;
 
  35     $aFilteredPlaces['properties']['geocoding']['label'] = $aPlace['langaddress'];
 
  37     if ($aPlace['placename'] !== null) {
 
  38         $aFilteredPlaces['properties']['geocoding']['name'] = $aPlace['placename'];
 
  41     if (isset($aPlace['address'])) {
 
  42         $aPlace['address']->addGeocodeJsonAddressParts(
 
  43             $aFilteredPlaces['properties']['geocoding']
 
  46         $aFilteredPlaces['properties']['geocoding']['admin']
 
  47             = $aPlace['address']->getAdminLevels();
 
  50     if (isset($aPlace['asgeojson'])) {
 
  51         $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']);
 
  53         $aFilteredPlaces['geometry'] = array(
 
  55                                         'coordinates' => array(
 
  56                                                           (float) $aPlace['lon'],
 
  57                                                           (float) $aPlace['lat']
 
  62     javascript_renderData(array(
 
  63                            'type' => 'FeatureCollection',
 
  66                                            'attribution' => 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
 
  70                            'features' => array($aFilteredPlaces)