:구글 지오 코더는 요청 값과 다른 위도와 경도를 반환
getLocationFromCoords(lat, lng) {
var geocoder = new google.maps.Geocoder();
var latLng = new google.maps.LatLng(parseFloat(lat), parseFloat(lng));
geocoder.geocode({
'latLng': latLng
}, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
if (typeof results[0].geometry.location != 'undefined') {
console.log(lat, lng);
console.log(results[0].geometry.location.lat(), results[0].geometry.location.lng());
// set the location
} else {
//...
}
});
});
}
문제는 results[0].geometry.location
에서 위도와 경도의 값 차이가 있다는 것입니다 요청. 콘솔에서 위의 코드가 표시
38.9067339 1.4205983
38.9069681 1.4205133000000387
그래서 난 아무것도 놓친 거지? 왜 같은 가치가 아닌가?
? LatLong으로 주소를 지정하거나 LatLong에 주소를 지정 하시겠습니까? –
@ TuğcaEker - LatLong으로 주소 지정 (위도 및 경도 포함). – Manolo
확인. 좌표를 주소로 변환하기 위해 ** 역 지오 코딩 **을 적용합니다. Google은 가장 가까운 기록을 사용자에게 반환하기 때문에 정확히 동일한 GeoLocation을 얻을 수 없습니다. 내가 점검 할 때, 기대와 결과 사이에는 20-30 미터 밖에 없습니다. 걱정하지 마세요. 정상입니다. –