Sto usando il codice seguente, ma come ottenere il nome della città o il nome della posizione dalla longitudine & latitudine?Come posso ottenere il nome della posizione o la città usando la latitudine e le longitudini?
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 –
provare l'API di Google Geocoding https://developers.google.com/maps/documentation/geocoding/ – rlemon