WEB JS

    웹 개발, 어플리케이션에서 활용될 수 있도록 Javascript로 제공되는 지도 플랫폼 입니다.

    사각형 생성 삭제하기


    지도위에 사각형 도형을 생성 삭제 할 수 있습니다.

    $(function () {
      var map = new routo.maps.Map("map", {
        center: { lat: 37.507009, lng: 127.0586339 }, // 지도 초기 위치
        zoom: 18, // 지도 로딩 시 최초 표시 레벨
      });
    
      var rectangle = null;
      $("#create-rectangle").click(function () {
        rectangle = new routo.maps.Rectangle({
          bounds: {
            east: 127.06528577835692,
            north: 37.4976633822354,
            south: 37.4949735341217,
            west: 127.05743227036133,
          }
        });
        rectangle.setMap(map);
    
        map.fitBounds(rectangle.getBounds(), {
          top: 170,
          right: 50,
          bottom: 30,
          left: 150,
        })
      });
    
      $("#delete-rectangle").click(function () {
        rectangle.setMap(null);
        rectangle = null;
      });
    });