]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-jsonv2.php
wrong variable name in json output
[nominatim.git] / lib / template / address-jsonv2.php
1 <?php
2         $aFilteredPlaces = array();
3
4         if (!sizeof($aPlace))
5         {
6                 if (isset($sError))
7                         $aFilteredPlaces['error'] = $sError;
8                 else
9                         $aFilteredPlaces['error'] = 'Unable to geocode';
10         }
11         else
12         {
13                 if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
14                 $aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
15                 $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
16                 if ($sOSMType)
17                 {
18                         $aFilteredPlaces['osm_type'] = $sOSMType;
19                         $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
20                 }
21                 if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
22                 if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
23                 $aFilteredPlaces['category'] = $aPlace['class'];
24                 $aFilteredPlaces['type'] = $aPlace['type'];
25                 $aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);
26
27                 $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
28                 $aFilteredPlaces['name'] = $aPlace['placename'];
29                 if ($bShowAddressDetails && $aAddress && sizeof($aAddress)) $aFilteredPlaces['address'] = $aAddress;
30         }
31
32         javascript_renderData($aFilteredPlaces);