Google Maps Api

H

H.Schmidt

Hi!

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)?

Thanks in advance
 
B

Bart Van der Donck

H.Schmidt said:
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&amp;v=2.x&amp;key=[XX]">
</script>
<script type="text/javascript"
src="http://google.com/uds/api?file=uds.js&amp;v=1.0">
</script>
<script type="text/javascript"
src="http://google.com/uds/solutions/localsearch/gmlocalsearch.js">
</script>
<script type="text/javascript">
function findInfo(x,y) {
if (GBrowserIsCompatible()) {
var s = new GlocalSearch();
var c = {
callback:function() {
if(s.results.length == 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.setCenterPoint(new GLatLng(x,y), 1);
s.setSearchCompleteCallback(c, c.callback);
s.execute(new GLatLng(0,0), 1);
}
}
</script>
</head>
<body onunload="GUnload()">
<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="findInfo(document.getElementById('X').value,
document.getElementById('Y').value);">
</body>
</html>

-------------------------------------------------------------------

Info:
http://code.google.com/apis/maps/documentation/reference.html
http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GlocalResult
(apparently there is no property for the ZIP-code)

Replace [XX] by your Maps API Key

Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top