]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-xml.php
finally fix adminitrative spelling error, disable fast_update on indexes by default...
[nominatim.git] / lib / template / search-xml.php
1 <?php\r
2         header("content-type: text/xml; charset=UTF-8");\r
3         header("Access-Control-Allow-Origin: *");\r
4 \r
5         echo "<";\r
6         echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";\r
7         echo ">\n";\r
8 \r
9         echo "<searchresults";\r
10         echo " timestamp='".date(DATE_RFC822)."'";\r
11         echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";\r
12         echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";\r
13         if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";\r
14         echo " polygon='".($bShowPolygons?'true':'false')."'";\r
15         if (sizeof($aExcludePlaceIDs))\r
16         {\r
17                 echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";\r
18         }\r
19         if ($sMoreURL)\r
20         {\r
21                 echo " more_url='".htmlspecialchars($sMoreURL)."'";\r
22         }\r
23         echo ">\n";\r
24 \r
25         foreach($aSearchResults as $iResNum => $aResult)\r
26         {\r
27                 echo "<place place_id='".$aResult['place_id']."'";\r
28                 $sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));\r
29                 if ($sOSMType)\r
30                 {\r
31                         echo " osm_type='$sOSMType'";\r
32                         echo " osm_id='".$aResult['osm_id']."'";\r
33                 }\r
34 \r
35                 if (isset($aResult['aBoundingBox']))\r
36                 {\r
37                         echo ' boundingbox="';\r
38                         echo $aResult['aBoundingBox'][0];\r
39                         echo ','.$aResult['aBoundingBox'][1];\r
40                         echo ','.$aResult['aBoundingBox'][2];\r
41                         echo ','.$aResult['aBoundingBox'][3];\r
42                         echo '"';\r
43 \r
44                         if ($bShowPolygons)\r
45                         {\r
46                                 echo ' polygonpoints=\'';\r
47                                 echo javascript_renderData($aResult['aPolyPoints']);\r
48                                 echo '\'';\r
49                         }\r
50                 }\r
51 \r
52                 if (isset($aResult['zoom']))\r
53                 {\r
54                         echo " zoom='".$aResult['zoom']."'";\r
55                 }\r
56 \r
57                 echo " lat='".$aResult['lat']."'";\r
58                 echo " lon='".$aResult['lon']."'";\r
59                 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";\r
60 \r
61                 echo " class='".htmlspecialchars($aResult['class'])."'";\r
62                 echo " type='".htmlspecialchars($aResult['type'])."'";\r
63                 if ($aResult['icon'])\r
64                 {\r
65                         echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";\r
66                 }\r
67 \r
68                 if (isset($aResult['address']))\r
69                 {\r
70                         echo ">";\r
71                         foreach($aResult['address'] as $sKey => $sValue)\r
72                         {\r
73                                 $sKey = str_replace(' ','_',$sKey);\r
74                                 echo "<$sKey>";\r
75                                 echo htmlspecialchars($sValue);\r
76                                 echo "</$sKey>";\r
77                         }\r
78 \r
79                         echo "</place>";\r
80                 }\r
81                 else\r
82                 {\r
83                         echo "/>";\r
84                 }\r
85         }\r
86         \r
87         echo "</searchresults>";\r