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']))
17 echo " exclude_place_ids='".htmlspecialchars($aMoreParams['exclude_place_ids'])."'";
19 echo " more_url='".htmlspecialchars($sMoreURL)."'";
22 foreach($aSearchResults as $iResNum => $aResult)
24 echo "<place place_id='".$aResult['place_id']."'";
25 $sOSMType = formatOSMType($aResult['osm_type']);
28 echo " osm_type='$sOSMType'";
29 echo " osm_id='".$aResult['osm_id']."'";
31 echo " place_rank='".$aResult['rank_search']."'";
33 if (isset($aResult['aBoundingBox']))
35 echo ' boundingbox="';
36 echo join(',',$aResult['aBoundingBox']);
39 if (isset($aResult['aPolyPoints']))
41 echo ' polygonpoints=\'';
42 echo json_encode($aResult['aPolyPoints']);
47 if (isset($aResult['asgeojson']))
50 echo $aResult['asgeojson'];
54 if (isset($aResult['assvg']))
57 echo $aResult['assvg'];
61 if (isset($aResult['astext']))
64 echo $aResult['astext'];
68 if (isset($aResult['zoom']))
70 echo " zoom='".$aResult['zoom']."'";
73 echo " lat='".$aResult['lat']."'";
74 echo " lon='".$aResult['lon']."'";
75 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
77 echo " class='".htmlspecialchars($aResult['class'])."'";
78 echo " type='".htmlspecialchars($aResult['type'], ENT_QUOTES)."'";
79 echo " importance='".htmlspecialchars($aResult['importance'])."'";
80 if (isset($aResult['icon']) && $aResult['icon'])
82 echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
87 if (isset($aResult['askml']))
95 echo $aResult['askml'];
99 if (isset($aResult['sExtraTags']))
106 echo "\n<extratags>";
107 foreach ($aResult['sExtraTags'] as $sKey => $sValue)
109 echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
114 if (isset($aResult['sNameDetails']))
121 echo "\n<namedetails>";
122 foreach ($aResult['sNameDetails'] as $sKey => $sValue)
124 echo '<name desc="'.htmlspecialchars($sKey).'">';
125 echo htmlspecialchars($sValue);
128 echo "</namedetails>";
131 if (isset($aResult['address']))
139 foreach($aResult['address'] as $sKey => $sValue)
141 $sKey = str_replace(' ','_',$sKey);
143 echo htmlspecialchars($sValue);
158 echo "</" . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . ">";