Monday, May 14, 2007

google map latititude and longitude finder

This is how you get the latitude and longitude from google map api...


var map = new GMap2(document.getElementById("map"));
var geocoder = new GClientGeocoder();
var latitude, longitude;

function showAddress(address) {
geocoder.getLatLng(
address,
function(point) {;
if (!point) {
alert(address + " not found");
} else {
latitude= point.lat();
longitude = point.lng();
}
}
);
}
showAddress("123 Main Street 00000");
this example requires three div stag for the getElementById call within google map api.
google format doesn't allow me to post HTML contents
but... there are three DIV tags with id of map, side_bar, demographics, and message. They are all indepedent.
I would do
document.getElementById("").style.display="none"
for the IDs.

No comments: