2013-03-27 17 views
11

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; 
} 
+1

http://en.wikipedia.org/wiki/Reverse_geocoding –

+0

provare l'API di Google Geocoding https://developers.google.com/maps/documentation/geocoding/ – rlemon

risposta

Problemi correlati