Google map 由經緯度取得地址的方法

// 取得此經緯度的地址
function getAddress(lat,lng) {


var myLatLng = new GLatLng(lat,lng);
var myGeocoder = new GClientGeocoder();
myGeocoder.getLocations(myLatLng, function (addresses) {
if (addresses.Status.code != 200) {
document.getElementById('MainContent_LabelLocation').innerText = myLatLng.toUrlValue();
} else {
var result = addresses.Placemark[0];
document.getElementById('LabelLocation').innerText = result.address;
}
});

}

留言

熱門文章