H.Schmidt wrote:
im would like to get address informations like city, state or zip for a
given GPoint. Is it possible (i found nothing in Google maps Api)?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Search Country, City, State, Address with GPoint</title>
<script type="text/javascript"
src="http://maps.google.com/maps?file=api&a mp;v=2.x&ke y=[XX]">
</script>
<script type="text/javascript"
src="http://google.com/uds/api?file=uds.js &v=1.0">
</script>
<script type="text/javascript"
src="http://google.com/uds/solutions/localsearch/gmlocalsearch.j s">
</script>
<script type="text/javascript">
function findInfo(x,y) {
if (GBrowserIsComp atible()) {
var s = new GlocalSearch();
var c = {
callback:functi on() {
if(s.results.le ngth == 0) {
alert('No result');
}
else {
alert('Country: ' + s.results[0].country);
alert('City: ' + s.results[0].city);
alert('State: ' + s.results[0].region);
alert('Address: ' + s.results[0].streetAddress) ;
}
}
};
s.setCenterPoin t(new GLatLng(x,y), 1);
s.setSearchComp leteCallback(c, c.callback);
s.execute(new GLatLng(0,0), 1);
}
}
</script>
</head>
<body onunload="GUnlo ad()">
<b>GPoint coordinates</b><br>
X: <input type="text" value="40.014" id="X" name="X"><br>
Y: <input type="text" value="0.846" id="Y" name="Y"><br>
<input type="button" value="Go"
onClick="findIn fo(document.get ElementById('X' ).value,
document.getEle mentById('Y').v alue);">
</body>
</html>
-------------------------------------------------------------------
Info:
http://code.google.com/apis/maps/doc...reference.html http://code.google.com/apis/ajaxsear...s_GlocalResult
(apparently there is no property for the ZIP-code)
Replace [XX] by your Maps API Key
Hope this helps,
--
Bart