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 = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':
26 ($aPlace['osm_type'] == 'T'?'tiger':($aPlace['osm_type'] == 'I'?'interpolation':'')))));
27 if ($sOSMType) echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
28 if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
29 if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
30 if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
31 if (isset($aPlace['aBoundingBox']))
33 echo ' boundingbox="';
34 echo join(',', $aPlace['aBoundingBox']);
38 if (isset($aPlace['asgeojson']))
41 echo $aPlace['asgeojson'];
45 if (isset($aPlace['assvg']))
48 echo $aPlace['assvg'];
52 if (isset($aPlace['astext']))
55 echo $aPlace['astext'];
58 echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
60 if (isset($aPlace['aAddress']))
62 echo "<addressparts>";
63 foreach($aPlace['aAddress'] as $sKey => $sValue)
65 $sKey = str_replace(' ','_',$sKey);
67 echo htmlspecialchars($sValue);
70 echo "</addressparts>";
73 if (isset($aPlace['sExtraTags']))
76 foreach ($aPlace['sExtraTags'] as $sKey => $sValue)
78 echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
83 if (isset($aPlace['sNameDetails']))
86 foreach ($aPlace['sNameDetails'] as $sKey => $sValue)
88 echo '<name desc="'.htmlspecialchars($sKey).'">';
89 echo htmlspecialchars($sValue);
92 echo "</namedetails>";
95 if (isset($aPlace['askml']))
98 echo $aPlace['askml'];
104 echo "</reversegeocode>";