我正在使用下面的代碼,但如何從經度&緯度獲取城市名稱或地點名稱?如何使用緯度和經度獲取位置名稱或城市?
var x=document.getElementById("location");
function getLocation()
{
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition,showError);
}
else {
x.innerHTML="Geolocation is not supported by this browser.";
}
}
function showPosition(position)
{
x.innerHTML="Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
http://en.wikipedia.org/wiki/Reverse_geocoding – 2013-03-27 15:30:43
嘗試Google地址解析API https://developers.google.com/maps/documentation/geocoding/ – rlemon 2013-03-27 15:32:27