구글 맵에서 주소를 이용해서 위도, 경도를 구해서 여분필드에 저장 하고 싶습니다.
아래에 있던 마커가 모두 위도, 경도로 구하는 샘플이라서..
주소에서 직접 마커 찍도록 바꾸는 것이 어려워서 그냥 여분필드에 미리 위도,경도를 구해서 저장해 놓을 까 합니다.
첨부 파일의 중간쯤 보면
alert("1: " + results[0].geometry.location.lat());
alert("2: " + results[0].geometry.location.lng());
가 있는데, 이부분을 게시판의 여분 필드 wr_3, wr_4에 저장하면 됩니다. (write_skin.php에서)
alert("2: " + results[0].geometry.location.lng());
가 있는데, 이부분을 게시판의 여분 필드 wr_3, wr_4에 저장하면 됩니다. (write_skin.php에서)
고수님들의 조언 부탁드립니다.
댓글 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>
이런식으로 이용하시면 될실거 같습니다..
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>
이런식으로 이용하시면 될실거 같습니다..
게시글 목록
| 번호 | 제목 |
|---|---|
| 12413 | |
| 12412 | |
| 12411 |
JavaScript
실시간 카운트 다운 시계 입니다.
|
| 12410 |
jQuery
jQuery, 이미지맵 마우스오버시 하이라이트 표시
|
| 12407 | |
| 12406 | |
| 12405 | |
| 12404 |
JavaScript
한번만 submit 되게 하기 입니다.
|
| 12403 |
JavaScript
영문자나 숫자만 입력 할 수 있게 하기 입니다.
|
| 12402 |
JavaScript
현재 페이지 이메일로 보내는 버튼 만들기 입니다.
|
| 12401 |
JavaScript
모바일웹에서 PC버전 링크
|
| 12400 |
JavaScript
특정 파일형태만 업로드 하기 입니다.
|
| 12399 |
JavaScript
입력 문자열 앞에 붙는 공백 제거하기 입니다.
|
| 12398 |
JavaScript
키보드 방향키로 창의 위치를 이동시키기 입니다.
|
| 12397 | |
| 12396 | |
| 12395 |
JavaScript
키보드 눌러 이동하는 단축키 사용하기 입니다.
|
| 12394 |
JavaScript
책장을 넘기는 것같은 이미지 슬라이드 쇼 입니다.
|
| 12393 |
JavaScript
마우스를 대면 링크 이미지들을 보여주기 입니다.
|
| 12392 |
PHP
pushbullet 푸시 발송
|
| 12391 |
MySQL
같은 컬럼의 행들을 한번에 UPDATE 하기
|
| 12390 |
JavaScript
이미지들을 보여주는 풀다운 콤보메뉴 입니다.
|
| 12389 |
JavaScript
부드럽게 오버랩되는 이미지 슬라이드 쇼 입니다.
|
| 12388 |
JavaScript
끊김없이 연속적으로 스크롤 되는 이미지 스크롤러 입니다.
|
| 12387 |
PHP
php 주요 정리 입니다.
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기