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)."'";
17 echo "<error>$sError</error>";
19 echo "<error>Unable to geocode</error>";
24 if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
25 $sOSMType = formatOSMType($aPlace['osm_type']);
26 if ($sOSMType) echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
27 if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
28 if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
29 if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
30 if (isset($aPlace['aBoundingBox']))
32 echo ' boundingbox="';
33 echo join(',', $aPlace['aBoundingBox']);
37 if (isset($aPlace['asgeojson']))
40 echo $aPlace['asgeojson'];
44 if (isset($aPlace['assvg']))
47 echo $aPlace['assvg'];
51 if (isset($aPlace['astext']))
54 echo $aPlace['astext'];
57 echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
59 if (isset($aPlace['aAddress']))
61 echo "<addressparts>";
62 foreach($aPlace['aAddress'] as $sKey => $sValue)
64 $sKey = str_replace(' ','_',$sKey);
66 echo htmlspecialchars($sValue);
69 echo "</addressparts>";
72 if (isset($aPlace['sExtraTags']))
75 foreach ($aPlace['sExtraTags'] as $sKey => $sValue)
77 echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
82 if (isset($aPlace['sNameDetails']))
85 foreach ($aPlace['sNameDetails'] as $sKey => $sValue)
87 echo '<name desc="'.htmlspecialchars($sKey).'">';
88 echo htmlspecialchars($sValue);
91 echo "</namedetails>";
94 if (isset($aPlace['askml']))
97 echo $aPlace['askml'];
103 echo "</reversegeocode>";