구글 맵에서 Lat, Long을 구해서 여분 필드에 넣기

구글 맵에서 주소를 이용해서 위도, 경도를 구해서 여분필드에 저장 하고 싶습니다.
아래에 있던 마커가 모두 위도, 경도로 구하는 샘플이라서..
주소에서 직접 마커 찍도록 바꾸는 것이 어려워서 그냥 여분필드에 미리 위도,경도를 구해서 저장해 놓을 까 합니다.
 
첨부 파일의 중간쯤 보면
         alert("1: " + results[0].geometry.location.lat());
         alert("2: " + results[0].geometry.location.lng());
가 있는데,  이부분을 게시판의 여분 필드 wr_3, wr_4에 저장하면 됩니다. (write_skin.php에서)
 
고수님들의 조언 부탁드립니다.

첨부파일

geocoding-simple.htm (1.7 KB) 12회 2012-01-08 13:13
|

댓글 1개

<script type="text/javascript">
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(36.778, -119.4179);
var myOptions = {
zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}

function codeAddress() {
var address = document.getElementById("wr_1").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
document.getElementById("wr_8").value= results[0].geometry.location.lat();
document.getElementById("wr_9").value= results[0].geometry.location.lng();
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
</script>

이런식으로 이용하시면 될실거 같습니다..
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 2,014
14년 전 조회 3,035
14년 전 조회 1,578
14년 전 조회 2,522
14년 전 조회 2,787
14년 전 조회 1,904
14년 전 조회 1,815
14년 전 조회 1,397
14년 전 조회 1,969
14년 전 조회 1,868
14년 전 조회 1,742
14년 전 조회 1,637
14년 전 조회 1,686
14년 전 조회 2,044
14년 전 조회 2,865
14년 전 조회 1,953
14년 전 조회 1,426
14년 전 조회 1.1만
14년 전 조회 1,732
14년 전 조회 1,615
14년 전 조회 2,163
14년 전 조회 3,298
14년 전 조회 2,074
14년 전 조회 1,787
14년 전 조회 1,585
14년 전 조회 2,463
14년 전 조회 1,753
14년 전 조회 3,132
14년 전 조회 1,583
14년 전 조회 1,597
14년 전 조회 1,707
14년 전 조회 2,419
14년 전 조회 1,570
14년 전 조회 3,044
14년 전 조회 1,375
14년 전 조회 3,986
14년 전 조회 4,134
14년 전 조회 4,059
14년 전 조회 3,863
14년 전 조회 1,572
14년 전 조회 1,517
14년 전 조회 2,026
14년 전 조회 2,285
14년 전 조회 1,478
14년 전 조회 1,542
14년 전 조회 1,458
14년 전 조회 5,532
14년 전 조회 1,438
14년 전 조회 5,828
14년 전 조회 2,139
14년 전 조회 1,931
14년 전 조회 1,394
14년 전 조회 1,577
14년 전 조회 2,101
14년 전 조회 1,581
14년 전 조회 2,246
14년 전 조회 1,770
14년 전 조회 1,554
14년 전 조회 1,688
14년 전 조회 3,728
14년 전 조회 1,466
14년 전 조회 2,058
14년 전 조회 1,678
14년 전 조회 1,629
14년 전 조회 1,517
14년 전 조회 4,179
14년 전 조회 2,073
14년 전 조회 1,528
14년 전 조회 1,623
14년 전 조회 1,600
14년 전 조회 1,675
14년 전 조회 1,441
14년 전 조회 1,526
14년 전 조회 2,159
14년 전 조회 4,046
14년 전 조회 2,459
14년 전 조회 1,541
14년 전 조회 1,521
14년 전 조회 1,629
14년 전 조회 1,511
14년 전 조회 1,618
14년 전 조회 1,740
14년 전 조회 1,429
14년 전 조회 3,927
14년 전 조회 3,816
14년 전 조회 1,640
14년 전 조회 2,136
14년 전 조회 1,766
14년 전 조회 1,594
14년 전 조회 4,092
14년 전 조회 3,091
14년 전 조회 2,672
14년 전 조회 2,599
14년 전 조회 1,377
14년 전 조회 2,146
14년 전 조회 1,387
14년 전 조회 1,412
14년 전 조회 1,452
14년 전 조회 1,874
14년 전 조회 1,874