]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-json.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib / template / address-json.php
1 <?php
2
3 $aFilteredPlaces = array();
4
5 if (!sizeof($aPlace)) {
6     if (isset($sError))
7         $aFilteredPlaces['error'] = $sError;
8     else $aFilteredPlaces['error'] = 'Unable to geocode';
9 } else {
10     if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
11     $aFilteredPlaces['licence'] = 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright';
12     $sOSMType = formatOSMType($aPlace['osm_type']);
13     if ($sOSMType) {
14         $aFilteredPlaces['osm_type'] = $sOSMType;
15         $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
16     }
17     if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
18     if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
19     $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
20     if (isset($aPlace['aAddress'])) $aFilteredPlaces['address'] = $aPlace['aAddress'];
21     if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['extratags'] = $aPlace['sExtraTags'];
22     if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['namedetails'] = $aPlace['sNameDetails'];
23
24     if (isset($aPlace['aBoundingBox'])) {
25         $aFilteredPlaces['boundingbox'] = $aPlace['aBoundingBox'];
26     }
27
28     if (isset($aPlace['asgeojson'])) {
29         $aFilteredPlaces['geojson'] = json_decode($aPlace['asgeojson']);
30     }
31
32     if (isset($aPlace['assvg'])) {
33         $aFilteredPlaces['svg'] = $aPlace['assvg'];
34     }
35
36     if (isset($aPlace['astext'])) {
37         $aFilteredPlaces['geotext'] = $aPlace['astext'];
38     }
39
40     if (isset($aPlace['askml'])) {
41         $aFilteredPlaces['geokml'] = $aPlace['askml'];
42     }
43 }
44
45 javascript_renderData($aFilteredPlaces);