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);
}
});
}
}
---------------------------------------------------------------------------------------------------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!
發佈留言