본문 바로가기

엔지니어/Linux

구글 지도 그리기

728x90
반응형
<!DOCTYPE html>
<html>
     <head>
          <title>Maps Project</title>
          <style>
               #map-canvas { width: 500px; height: 400px; background-color: #CCC; }
          </style>
         
          <script>
               function initialize() {
                    var mapCanvas = document.getElementById('map-canvas');
                    var myLatlng = new google.maps.LatLng(35.1466317,129.0596543);          // 위경도 설정
                    var mapOptions = {               // 구글 맵 옵션
                         center: myLatlng,
                         zoom: 16,
                         mapTypeId: google.maps.MapTypeId.ROADMAP
                    };
 
                    // 구글 맵 생성
                    var map = new google.maps.Map(mapCanvas, mapOptions);
              
                    var contentString = '<div style="width:100px;height:50px;">SSM</div>';          // 말풍선 내용
              
                    var infowindow = new google.maps.InfoWindow({
                         content: contentString,
                         size: new google.maps.Size(200,100)
                    });
              
                    var marker = new google.maps.Marker({
                         position: myLatlng,
                         map: map,
                        draggable:true,               // 마커 드래그 가능
                         title: 'Hello World!'     // 마커 : 도움말 풍선(마우스 오버 시)
                    });
                    google.maps.event.addListener(marker, 'click', function() {
                         infowindow.open(map, marker);
 
                         if (marker.getAnimation() != null) {
                              marker.setAnimation(null);
                         } else {
                              marker.setAnimation(google.maps.Animation.BOUNCE);
                         }
                    });
 
                    marker.setMap(map);
               }
              
               google.maps.event.addDomListener(window, 'load', initialize);
          </script>
     </head>
     <body>
          <div id="map-canvas"></div>
     </body>
</html>
 
반응형

'엔지니어 > Linux' 카테고리의 다른 글

RHEL 8.x Mysql MHA 설치 오류(Perl)  (0) 2023.11.06
전 세계 보안 위기, 오픈SSL 치명적 취약점 발견  (0) 2022.10.31
정규표현식(레귤러 익스프레션)  (0) 2022.10.28
pdns install  (0) 2022.10.28
rhel 8 repo 설정  (0) 2022.10.28