Google Map ~ get latitude, longitude by address or city

This is an example ~

get latitude, longitude and set marker by address, city .....etc
---------------------------------------------------------------------------------------------------

var geocoder = new GClientGeocoder();
function showAddress(address)
{
if (geocoder)
{
geocoder.getLatLng(address,function(point)
{
if (!point) {
alert(address + " not found");
} else {

map.setCenter(point,10);
var marker = new GMarker(point);

GEvent.addListener(marker, "click", function() { marker.openInfoWindowTabsHtml('Your start Address'); });
map.addOverlay(marker);
}
});
}
}
---------------------------------------------------------------------------------------------------

call function like this

showAddress('los angeles');


reference
http://itouchmap.com/latlong.html

1 則留言:

匿名 說...

It is more than word!