« 終了していない文字型の定数 IE | メイン | 3時間後 »
2009年11月04日
座標から住所 住所から座標 google map
住所から座標address=”住所”;
var geocoder = new GClientGeocoder(); geocoder.getLatLng( address, function(point) { if (!point) { //alert(address + " not found"); } else { map.setCenter(point, 16); } });
座標から住所
var point = marker.getLatLng(); var geocoder = new GClientGeocoder(); geocoder.getLocations(point, function(addresses) { var n; if(addresses.Status.code == 200) { for(p=0;p<addresses.Placemark.length;p++){ if(addresses.Placemark[p].AddressDetails.Accuracy == 4){ document.form1.shop_place.value = addresses.Placemark[n].AddressDetails.Country.AdministrativeArea.AdministrativeAreaName +addresses.Placemark[n].AddressDetails.Country.AdministrativeArea.Locality.LocalityName; } } } });座標求めと違って候補が何個もでてくるのがめんどうだが、Accuracyをみて希望の情報をゲットすべし
投稿者 muuming : 2009年11月04日 17:51