]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-json.php
fix more syntax errors in error functions
[nominatim.git] / lib / template / address-json.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 (isset($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 = formatOSMType($aPlace['osm_type']);
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['display_name'] = $aPlace['langaddress'];
24                 if (isset($aPlace['aAddress'])) $aFilteredPlaces['address'] = $aPlace['aAddress'];
25                 if (isset($aPlace['sExtraTags'])) $aFilteredPlaces['extratags'] = $aPlace['sExtraTags'];
26                 if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['namedetails'] = $aPlace['sNameDetails'];
27
28                 if (isset($aPlace['aBoundingBox']))
29                 {
30                         $aFilteredPlaces['boundingbox'] = $aPlace['aBoundingBox'];
31                 }
32
33                 if (isset($aPlace['asgeojson']))
34                 {
35                         $aFilteredPlaces['geojson'] = json_decode($aPlace['asgeojson']);
36                 }
37
38                 if (isset($aPlace['assvg']))
39                 {
40                         $aFilteredPlaces['svg'] = $aPlace['assvg'];
41                 }
42
43                 if (isset($aPlace['astext']))
44                 {
45                         $aFilteredPlaces['geotext'] = $aPlace['astext'];
46                 }
47
48                 if (isset($aPlace['askml']))
49                 {
50                         $aFilteredPlaces['geokml'] = $aPlace['askml'];
51                 }
52         }
53
54         javascript_renderData($aFilteredPlaces);
55