2 header('content-type: text/xml; charset=UTF-8');
5 echo '?xml version="1.0" encoding="UTF-8" ?';
9 echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults');
10 echo " timestamp='".date(DATE_RFC822)."'";
11 echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
12 echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
13 if (isset($aMoreParams['viewbox'])) echo " viewbox='".htmlspecialchars($aMoreParams['viewbox'], ENT_QUOTES)."'";
14 echo " polygon='".(isset($aMoreParams['polygon'])?'true':'false')."'";
15 if (isset($aMoreParams['exclude_place_ids'])) {
16 echo " exclude_place_ids='".htmlspecialchars($aMoreParams['exclude_place_ids'])."'";
18 echo " more_url='".htmlspecialchars($sMoreURL)."'";
21 foreach ($aSearchResults as $iResNum => $aResult) {
22 echo "<place place_id='".$aResult['place_id']."'";
23 $sOSMType = formatOSMType($aResult['osm_type']);
25 echo " osm_type='$sOSMType'";
26 echo " osm_id='".$aResult['osm_id']."'";
28 echo " place_rank='".$aResult['rank_search']."'";
30 if (isset($aResult['aBoundingBox'])) {
31 echo ' boundingbox="';
32 echo join(',', $aResult['aBoundingBox']);
35 if (isset($aResult['aPolyPoints'])) {
36 echo ' polygonpoints=\'';
37 echo json_encode($aResult['aPolyPoints']);
42 if (isset($aResult['asgeojson'])) {
44 echo $aResult['asgeojson'];
48 if (isset($aResult['assvg'])) {
50 echo $aResult['assvg'];
54 if (isset($aResult['astext'])) {
56 echo $aResult['astext'];
60 if (isset($aResult['zoom'])) {
61 echo " zoom='".$aResult['zoom']."'";
64 echo " lat='".$aResult['lat']."'";
65 echo " lon='".$aResult['lon']."'";
66 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
68 echo " class='".htmlspecialchars($aResult['class'])."'";
69 echo " type='".htmlspecialchars($aResult['type'], ENT_QUOTES)."'";
70 echo " importance='".htmlspecialchars($aResult['importance'])."'";
71 if (isset($aResult['icon']) && $aResult['icon']) {
72 echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
77 if (isset($aResult['askml'])) {
83 echo $aResult['askml'];
87 if (isset($aResult['sExtraTags'])) {
93 foreach ($aResult['sExtraTags'] as $sKey => $sValue) {
94 echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
99 if (isset($aResult['sNameDetails'])) {
104 echo "\n<namedetails>";
105 foreach ($aResult['sNameDetails'] as $sKey => $sValue) {
106 echo '<name desc="'.htmlspecialchars($sKey).'">';
107 echo htmlspecialchars($sValue);
110 echo '</namedetails>';
113 if (isset($aResult['address'])) {
119 foreach ($aResult['address'] as $sKey => $sValue) {
120 $sKey = str_replace(' ', '_', $sKey);
122 echo htmlspecialchars($sValue);
134 echo '</' . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . '>';