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 if (isset($aMoreParams['exclude_place_ids'])) {
15 echo " exclude_place_ids='".htmlspecialchars($aMoreParams['exclude_place_ids'])."'";
17 echo " more_url='".htmlspecialchars($sMoreURL)."'";
20 foreach ($aSearchResults as $iResNum => $aResult) {
21 echo "<place place_id='".$aResult['place_id']."'";
22 $sOSMType = formatOSMType($aResult['osm_type']);
24 echo " osm_type='$sOSMType'";
25 echo " osm_id='".$aResult['osm_id']."'";
27 echo " place_rank='".$aResult['rank_search']."'";
29 if (isset($aResult['aBoundingBox'])) {
30 echo ' boundingbox="';
31 echo join(',', $aResult['aBoundingBox']);
35 if (isset($aResult['asgeojson'])) {
37 echo $aResult['asgeojson'];
41 if (isset($aResult['assvg'])) {
43 echo $aResult['assvg'];
47 if (isset($aResult['astext'])) {
49 echo $aResult['astext'];
53 if (isset($aResult['zoom'])) {
54 echo " zoom='".$aResult['zoom']."'";
57 echo " lat='".$aResult['lat']."'";
58 echo " lon='".$aResult['lon']."'";
59 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
61 echo " class='".htmlspecialchars($aResult['class'])."'";
62 echo " type='".htmlspecialchars($aResult['type'], ENT_QUOTES)."'";
63 echo " importance='".htmlspecialchars($aResult['importance'])."'";
64 if (isset($aResult['icon']) && $aResult['icon']) {
65 echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
70 if (isset($aResult['askml'])) {
76 echo $aResult['askml'];
80 if (isset($aResult['sExtraTags'])) {
86 foreach ($aResult['sExtraTags'] as $sKey => $sValue) {
87 echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
92 if (isset($aResult['sNameDetails'])) {
97 echo "\n<namedetails>";
98 foreach ($aResult['sNameDetails'] as $sKey => $sValue) {
99 echo '<name desc="'.htmlspecialchars($sKey).'">';
100 echo htmlspecialchars($sValue);
103 echo '</namedetails>';
106 if (isset($aResult['address'])) {
112 foreach ($aResult['address']->getAddressNames() as $sKey => $sValue) {
113 $sKey = str_replace(' ', '_', $sKey);
115 echo htmlspecialchars($sValue);
127 echo '</' . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . '>';