WEB JS

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

    폴리라인 생성 삭제하기


    지도위에 폴리라인 도형을 생성 삭제 할 수 있습니다.

    $(function () {
      var map = new routo.maps.Map("map", {
        center: { lat: 37.507009, lng: 127.0586339 }, // 지도 초기 위치
        zoom: 18, // 지도 로딩 시 최초 표시 레벨
      });
    
      var polyline = null;
      $("#create-polyline").click(function() {
        polyline = new routo.maps.Polyline({
          path: [
            { "lat": 37.511088, "lng": 127.059641},
            { "lat": 37.511074, "lng": 127.060936},
            { "lat": 37.510851, "lng": 127.061092},
            { "lat": 37.511063, "lng": 127.061716},
            { "lat": 37.505186, "lng": 127.065044},
            { "lat": 37.501141, "lng": 127.052661},
            { "lat": 37.501141, "lng": 127.052661},
            { "lat": 37.496867, "lng": 127.054670},
            { "lat": 37.497411, "lng": 127.056305},
            { "lat": 37.497565, "lng": 127.055612}
          ]
        });
        polyline.setMap(map);
      
        map.fitBounds(polyline.getBounds(), {
          top: 170,
          right: 50,
          bottom: 30,
          left: 150,
        });
      });
    
      $("#delete-polyline").click(function() {
        polyline.setMap(null);
        polyline = null;
      });
    });