2016-11-24 12 views
-3

많은 웹 사이트에서 솔루션을 이미 검색했지만 그 중 아무도 작동하지 않았습니다. 시간 이후JavaScript에서 위도와 경도가있는 도시 이름을 찾는 방법은 무엇입니까?

은 내가 위도와 경도 내 x, y 변수에 입력 상자에서 얻을 것이다 값을 사용하여 도시의 이름을 얻기 위해 노력하고 있지만 예는 일이 없습니다.

Google지도 API에서도 읽었지만 유용하지 않았습니다.

이미 API 키가 있습니다.

어쩌면 해결책이 있습니까?

나는 웹 사이트에서 가져온 및 시도했지만 성공하지 않고이 예제 :

function myFunction() { var x='xxxxx'; var y='xxxxx'; //my coordinates 
    var geocoder = new google.maps.Geocoder; 
    var latlng = {lat: parseFloat(x), lng: parseFloat(y)}; 

    geocoder.geocode({'location': latlng}, function(results, status) { 
     if (status === google.maps.GeocoderStatus.OK) { 
     // ... 
     } else { 
      window.alert('No results found'); 
     } 
     } else { 
      window.alert('Geocoder failed due to: ' + status); 
     } 
    }); 
} 
+1

이 시도이 부여 Geo location API

샘플 요청 찾아보십시오 : http://stackoverflow.com/questions/67975 69/get-city-name-using-geolocation – Bassie

+0

http://www.geocodezip.com/v3_GoogleEx_geocoding-reverse2postcodeD.html – geocodezip

+0

와우 감사합니다. :)이 사이트를 사랑하십시오! – sinanto

답변