地図上にプッシュピンを設定できますが、その地点の緯度と経度を取得できません。これが私のコードです。誰でもこれを手伝ってもらえますか?
ありがとう
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);
}
});
}