]> 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 {
7     if (isset($sError))
8         $aFilteredPlaces['error'] = $sError;
9     else
10         $aFilteredPlaces['error'] = 'Unable to geocode';
11 }
12 else
13 {
14     if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
15     $aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
16     $sOSMType = formatOSMType($aPlace['osm_type']);
17     if ($sOSMType)
18     {
19         $aFilteredPlaces['osm_type'] = $sOSMType;
20         $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
21     }
22     if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
23     if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
24     $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
25     if (isset($aPlace['aAddress'])) $aFilteredPlaces['address'] = $aPlace['aAddress'];
26     if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['extratags'] = $aPlace['sExtraTags'];
27     if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['namedetails'] = $aPlace['sNameDetails'];
28
29     if (isset($aPlace['aBoundingBox']))
30     {
31         $aFilteredPlaces['boundingbox'] = $aPlace['aBoundingBox'];
32     }
33
34     if (isset($aPlace['asgeojson']))
35     {
36         $aFilteredPlaces['geojson'] = json_decode($aPlace['asgeojson']);
37     }
38
39     if (isset($aPlace['assvg']))
40     {
41         $aFilteredPlaces['svg'] = $aPlace['assvg'];
42     }
43
44     if (isset($aPlace['astext']))
45     {
46         $aFilteredPlaces['geotext'] = $aPlace['astext'];
47     }
48
49     if (isset($aPlace['askml']))
50     {
51         $aFilteredPlaces['geokml'] = $aPlace['askml'];
52     }
53 }
54
55 javascript_renderData($aFilteredPlaces);
56