다음 코드를 사용하여지도와 디스플레이를 호출합니다. 역 지오 코드를 수행하고 해당 번지를 출력하는 함수를 추가하고 싶습니다. 함수에 long/lat 좌표를 전달할 수 없습니다. 긴/위도 좌표를 도로 주소로 변환하려면 어떻게해야합니까?지오 코드 리버스
function getMyLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
displayLocation, displayError, {
enableHighAccuracy: true,
timeout: 9000
});
var watchButton = document.getElementById("watch");
watchButton.onclick = watchLocation;
var clearWatchButton = document.getElementById("clearWatch");
clearWatchButton.onclick = clearWatch;
}
else {
alert("Oops, no geolocation support");
}
}
function displayLocation(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var div = document.getElementById("location");
div.innerHTML = "You are at Latitude: " + latitude + ", Longitude: " + longitude;
div.innerHTML += " (with " + position.coords.accuracy + " meters accuracy)";
var km = computeDistance(position.coords, ourCoords);
var distance = document.getElementById("distance");
distance.innerHTML = "You are " + km + " km from the WickedlySmart HQ";
if (map == null) {
showMap(position.coords);
prevCoords = position.coords;
}
else {
var meters = computeDistance(position.coords, prevCoords) * 1000;
if (meters > 20) {
scrollMapToPosition(position.coords);
prevCoords = position.coords;
}
}
}
예 로저 위에서 작동하고 일을. 길항 정보를 역 지오 코드 함수로 푸시하고 거리 주소를 가져 오는 기능을 추가하려고합니다. 나는 그 거리 주소를 표시 할 것이다. 이것이 제가 도움이 필요한 부분입니다. 거리 주소를 얻는 방법. – user1449862