如何在javascript中将纬度和经度值转换为地址?我曾尝试过地理定位,但它只显示 10 个地址。它不会显示超过十个地址。我的代码:
if (result.Status.code == G_GEO_SUCCESS) {
for ( var i = 0; i < result.Placemark.length; i++) {
var addres = result.Placemark[i].address;
// var t1=setTimeout(function(){x.value="2 seconds"},2000);
if (addres == "") {
// alert('blank');
document.getElementById("msg" + noofid).innerHTML = "Unable to find location";
} else {
document.getElementById("msg" + noofid).innerHTML = result.Placemark[i].address;
}
//alert("address");
}
}
// ====== Decode the error status ======
else {
var reason = "Code " + result.Status.code;
if (reasons[result.Status.code]) {
reason = reasons[result.Status.code];
}
alert('Could not find "' + search + '" '
+ reason);
}
});
}