2010-09-04 36 views
11

Sitemin kullanıcıları tarafından enlem ve boylam olarak bulmak için HTML5 Coğrafi Konum API'sini kullanıyorum. Bu işe yarıyor, ama şimdi ekranda "Sen inandırıcı bir şekilde ..." göstermesini istiyorum. Bu yüzden Coğrafi Konum API'sından aldığım bu koordinatları bir yer adına dönüştürmem gerekiyor.Koordinatları yer adına dönüştürün

Google Maps API ile biraz denedim, ancak çalışmadım.

Bunu nasıl yapacağını herkes biliyor mu?

Bu benim kodudur bugüne kadar

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAA55ubMQxcIybj35yHYV_iGRTrPfqOlZVmBxwB40M45alaTGbn0hTaoOvTqt2CB0iR6c1SkxYmRqRvHA" type="text/javascript"></script> 

    <script type="text/javascript"> 


      // When loaded go to: 
      initiate_geolocation(); 

      function initiate_geolocation() { 
       navigator.geolocation.getCurrentPosition(handle_geolocation_query,handle_errors); 
      } 

      function handle_errors(error) 
      { 
       switch(error.code) 
       { 
        case error.PERMISSION_DENIED: document.getElementById("geo").innerHTML = "User did not share geolocation data"; 
        break; 

        case error.POSITION_UNAVAILABLE: document.getElementById("geo").innerHTML = "Could not detect current position"; 
        break; 

        case error.TIMEOUT: document.getElementById("geo").innerHTML = "retrieving geolocation position timed out"; 
        break; 

        default: document.getElementById("geo").innerHTML = "unknown geolocation error"; 
        break; 
       } 
      } 

      function handle_geolocation_query(position){ 
       document.getElementById("geo").innerHTML = "Your coordinates are " + position.coords.latitude + ", " + position.coords.longitude; 

var geoCoder = new GClientGeocoder(); 

    geoCoder.getLocations(new GLatLng(position.coords.latitude, position.coords.longituder, true), getPositionName()); 


      } 

function getPositionName(response) 
{ 
// 
// Here I don't know what to do 
// 
} 
    </script> 

sayesinde
Vincent

cevap

İlgili konular