-1
지도에서 압정을 설정할 수는 있지만 그 지점의 위도와 경도는 검색 할 수 없습니다. 여기 내 코드가있다. 아무도 이것으로 도울 수 있습니까?Google지도에서 위도와 경도 검색
감사
function codeaddress() {
var geocoder;
//map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
geocoder = new google.maps.Geocoder();
var address = document.getElementById("address").value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
animation: google.maps.Animation.BOUNCE,
flat: false,
map: map,
position: results[0].geometry.location
});
var latt = document.getElementById("latitude");
latt.value = results[0].geometry.location.getlatitude();
alert(latt.value);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
이 먼저 기본적인 디버깅이 필요합니다 :
는 LatLng를 클래스에 대한 API를 참조하십시오. 정확히 어디가 잘못 될까요? –결과 [0] .geometry.location.lat() – Rafe
Rafe, 시도한 결과 [0] .geometry.location.lat(). 위도를 얻지 못했습니다. – user2147447