2 header("content-type: text/xml; charset=UTF-8");
\r
3 header("Access-Control-Allow-Origin: *");
\r
6 echo "?xml version=\"1.0\" encoding=\"UTF-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
17 echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
\r
21 echo " more_url='".htmlspecialchars($sMoreURL)."'";
\r
25 foreach($aSearchResults as $iResNum => $aResult)
\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
31 echo " osm_type='$sOSMType'";
\r
32 echo " osm_id='".$aResult['osm_id']."'";
\r
34 echo " place_rank='".$aResult['rank_search']."'";
\r
36 if (isset($aResult['aBoundingBox']))
\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
47 echo ' polygonpoints=\'';
\r
48 echo javascript_renderData($aResult['aPolyPoints']);
\r
53 if (isset($aResult['zoom']))
\r
55 echo " zoom='".$aResult['zoom']."'";
\r
58 echo " lat='".$aResult['lat']."'";
\r
59 echo " lon='".$aResult['lon']."'";
\r
60 echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
\r
62 echo " class='".htmlspecialchars($aResult['class'])."'";
\r
63 echo " type='".htmlspecialchars($aResult['type'])."'";
\r
64 if ($aResult['icon'])
\r
66 echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
\r
69 if (isset($aResult['address']))
\r
72 foreach($aResult['address'] as $sKey => $sValue)
\r
74 $sKey = str_replace(' ','_',$sKey);
\r
76 echo htmlspecialchars($sValue);
\r
88 echo "</searchresults>";
\r