]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-json.php
details html page: no longer use place_id in URLs
[nominatim.git] / lib / template / address-json.php
1 <?php
2
3 $aFilteredPlaces = array();
4
5 if (empty($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
20     if ($sOutputFormat == 'jsonv2' || $sOutputFormat == 'geojson') {
21         $aFilteredPlaces['place_rank'] = $aPlace['rank_search'];
22
23         $aFilteredPlaces['category'] = $aPlace['class'];
24         $aFilteredPlaces['type'] = $aPlace['type'];
25
26         $aFilteredPlaces['importance'] = $aPlace['importance'];
27
28         $aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);
29
30         $aFilteredPlaces['name'] = $aPlace['placename'];
31     }
32
33     $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
34
35     if (isset($aPlace['address'])) {
36         $aFilteredPlaces['address'] = $aPlace['address']->getAddressNames();
37     }
38     if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['extratags'] = $aPlace['sExtraTags'];
39     if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['namedetails'] = $aPlace['sNameDetails'];
40
41     if (isset($aPlace['aBoundingBox'])) {
42         $aFilteredPlaces['boundingbox'] = $aPlace['aBoundingBox'];
43     }
44
45     if (isset($aPlace['asgeojson'])) {
46         $aFilteredPlaces['geojson'] = json_decode($aPlace['asgeojson']);
47     }
48
49     if (isset($aPlace['assvg'])) {
50         $aFilteredPlaces['svg'] = $aPlace['assvg'];
51     }
52
53     if (isset($aPlace['astext'])) {
54         $aFilteredPlaces['geotext'] = $aPlace['astext'];
55     }
56
57     if (isset($aPlace['askml'])) {
58         $aFilteredPlaces['geokml'] = $aPlace['askml'];
59     }
60 }
61
62 javascript_renderData($aFilteredPlaces);