2 header("content-type: text/xml; charset=UTF-8");
5 echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
9 echo " timestamp='".date(DATE_RFC822)."'";
10 echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
11 echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
12 if (isset($_GET['viewbox']) && $_GET['viewbox']) echo " viewbox='".htmlspecialchars($_GET['viewbox'], ENT_QUOTES)."'";
13 echo " polygon='".($bShowPolygons?'true':'false')."'";
14 if (sizeof($aExcludePlaceIDs))
16 echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
20 echo " more_url='".htmlspecialchars($sMoreURL)."'";
24 foreach($aSearchResults as $iResNum => $aResult)
26 echo "<place place_id='".$aResult['place_id']."'";
27 $sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));
30 echo " osm_type='$sOSMType'";
31 echo " osm_id='".$aResult['osm_id']."'";
33 echo " place_rank='".$aResult['rank_search']."'";
35 if (isset($aResult['aBoundingBox']))
37 echo ' boundingbox="';
38 echo $aResult['aBoundingBox'][0];
39 echo ','.$aResult['aBoundingBox'][1];
40 echo ','.$aResult['aBoundingBox'][2];
41 echo ','.$aResult['aBoundingBox'][3];
44 if ($bShowPolygons && isset($aResult['aPolyPoints']))
46 echo ' polygonpoints=\'';
47 echo json_encode($aResult['aPolyPoints']);
52 if (isset($aResult['asgeojson']))
55 echo $aResult['asgeojson'];
59 if (isset($aResult['assvg']))
62 echo $aResult['assvg'];
66 if (isset($aResult['astext']))
69 echo $aResult['astext'];
73 if (isset($aResult['zoom']))
75 echo " zoom='".$aResult['zoom']."'";
78 echo " lat='".$aResult['lat']."'";
79 echo " lon='".$aResult['lon']."'";
80 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
82 echo " class='".htmlspecialchars($aResult['class'])."'";
83 echo " type='".htmlspecialchars($aResult['type'])."'";
84 echo " importance='".htmlspecialchars($aResult['importance'])."'";
85 if (isset($aResult['icon']) && $aResult['icon'])
87 echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
90 if (isset($aResult['address']) || isset($aResult['askml']))
95 if (isset($aResult['askml']))
98 echo $aResult['askml'];
102 if (isset($aResult['address']))
105 foreach($aResult['address'] as $sKey => $sValue)
107 $sKey = str_replace(' ','_',$sKey);
109 echo htmlspecialchars($sValue);
114 if (isset($aResult['address']) || isset($aResult['askml']))
124 echo "</searchresults>";