2 header('content-type: text/xml; charset=UTF-8');
5 echo '?xml version="1.0" encoding="UTF-8" ?';
8 echo '<reversegeocode';
9 echo " timestamp='".date(DATE_RFC822)."'";
10 echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
11 echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
16 echo "<error>$sError</error>";
18 echo '<error>Unable to geocode</error>';
22 if ($aPlace['place_id']) {
23 echo ' place_id="'.$aPlace['place_id'].'"';
25 $sOSMType = formatOSMType($aPlace['osm_type']);
27 echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
30 echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
32 if (isset($aPlace['lat'])) {
33 echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
35 if (isset($aPlace['lon'])) {
36 echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
38 if (isset($aPlace['aBoundingBox'])) {
39 echo ' boundingbox="';
40 echo join(',', $aPlace['aBoundingBox']);
43 echo " place_rank='".$aPlace['rank_search']."'";
44 echo " address_rank='".$aPlace['rank_address']."'";
47 if (isset($aPlace['asgeojson'])) {
49 echo $aPlace['asgeojson'];
53 if (isset($aPlace['assvg'])) {
55 echo $aPlace['assvg'];
59 if (isset($aPlace['astext'])) {
61 echo $aPlace['astext'];
64 echo '>'.htmlspecialchars($aPlace['langaddress']).'</result>';
66 if (isset($aPlace['address'])) {
67 echo '<addressparts>';
68 foreach ($aPlace['address']->getAddressNames() as $sKey => $sValue) {
69 $sKey = str_replace(' ', '_', $sKey);
71 echo htmlspecialchars($sValue);
74 echo '</addressparts>';
77 if (isset($aPlace['sExtraTags'])) {
79 foreach ($aPlace['sExtraTags'] as $sKey => $sValue) {
80 echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
85 if (isset($aPlace['sNameDetails'])) {
87 foreach ($aPlace['sNameDetails'] as $sKey => $sValue) {
88 echo '<name desc="'.htmlspecialchars($sKey).'">';
89 echo htmlspecialchars($sValue);
92 echo '</namedetails>';
95 if (isset($aPlace['askml'])) {
97 echo $aPlace['askml'];
102 echo '</reversegeocode>';