]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-xml.php
remove unused protolib
[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                 echo " place_rank='".$aResult['rank_search']."'";\r
35 \r
36                 if (isset($aResult['aBoundingBox']))\r
37                 {\r
38                         echo ' boundingbox="';\r
39                         echo $aResult['aBoundingBox'][0];\r
40                         echo ','.$aResult['aBoundingBox'][1];\r
41                         echo ','.$aResult['aBoundingBox'][2];\r
42                         echo ','.$aResult['aBoundingBox'][3];\r
43                         echo '"';\r
44 \r
45                         if ($bShowPolygons)\r
46                         {\r
47                                 echo ' polygonpoints=\'';\r
48                                 echo javascript_renderData($aResult['aPolyPoints']);\r
49                                 echo '\'';\r
50                         }\r
51                 }\r
52 \r
53                 if (isset($aResult['zoom']))\r
54                 {\r
55                         echo " zoom='".$aResult['zoom']."'";\r
56                 }\r
57 \r
58                 echo " lat='".$aResult['lat']."'";\r
59                 echo " lon='".$aResult['lon']."'";\r
60                 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";\r
61 \r
62                 echo " class='".htmlspecialchars($aResult['class'])."'";\r
63                 echo " type='".htmlspecialchars($aResult['type'])."'";\r
64                 if ($aResult['icon'])\r
65                 {\r
66                         echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";\r
67                 }\r
68 \r
69                 if (isset($aResult['address']))\r
70                 {\r
71                         echo ">";\r
72                         foreach($aResult['address'] as $sKey => $sValue)\r
73                         {\r
74                                 $sKey = str_replace(' ','_',$sKey);\r
75                                 echo "<$sKey>";\r
76                                 echo htmlspecialchars($sValue);\r
77                                 echo "</$sKey>";\r
78                         }\r
79 \r
80                         echo "</place>";\r
81                 }\r
82                 else\r
83                 {\r
84                         echo "/>";\r
85                 }\r
86         }\r
87         \r
88         echo "</searchresults>";\r