みなさま、
はじめまして馬渕と申します。
初歩的な質問で大変恐縮ではございますが、Google Maps APIを使った位置情報の
精度について教えてください。
[問題点]
1. Google Maps APIを使用し、東京都中央区銀座エリアの経度・緯度を取得する。
2. 「1」で取得した経度・緯度をGoogle maps上にて表示する。
→マークされる場所が誤っている。
例えば、以下の住所にて上記の問題が発生します。
東京都中央区銀座3-5-3
東京都中央区銀座2-8-20
東京都中央区銀座4-4-10
検証用に作成したソースもあわせて記載しておきます。
-----
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="
http://maps.google.com/maps/api/js?
sensor=false&language=ja®ion=ja"></script>
<script type="text/javascript">
var geocoder;
function initialize() {
geocoder = new google.maps.Geocoder();
}
function codeAddress() {
var address = document.getElementById("address").value;
var latlng2;
if (geocoder) {
geocoder.geocode( { 'address': address}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK) {
document.getElementById("lat").value =
results[0].geometry.location.lat();
document.getElementById("lng").value =
results[0].geometry.location.lng();
latlng2=results[0].geometry.location;
geocoder.geocode({'latLng': latlng2, 'region' : "jp"},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
document.getElementById("ad").value =
results[0].formatted_address;
} else {
alert("Geocode was not successful for the following reason: " +
status);
}
});
} else {
alert("Geocode was not successful for the following reason: " +
status);
}
});
}
}
</script>
-----
上記現象の解決方法をご存じの方がいらっしゃいましたら、ご教授のほど
よろしくお願いいたします。