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 if ($aPlace['osm_type'] && $aPlace['osm_id']) echo ' osm_type="'.($aPlace['osm_type']=='N'?'node':($aPlace['osm_type']=='W'?'way':'relation')).'"'.' osm_id="'.$aPlace['osm_id'].'"';
26 if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
27 if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
28 if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
29 echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
31 if ($bShowAddressDetails) {
32 echo "<addressparts>";
33 foreach($aAddress as $sKey => $sValue)
35 $sKey = str_replace(' ','_',$sKey);
37 echo htmlspecialchars($sValue);
40 echo "</addressparts>";
44 echo "</reversegeocode>";