$(function(){var map =newrouto.maps.Map("map",{center:{lat:37.507009,lng:127.0586339},// 지도 초기 위치zoom:18,// 지도 로딩 시 최초 표시 레벨});var rectangle =null;$("#create-rectangle").click(function(){
rectangle =newrouto.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;});});
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"/><title>사각형 생성 삭제하기</title><style>html,
body{margin: 0;padding: 0;width: 100%;height: 100%;}.map{width: 100%;height: 400px;position: relative;}</style></head><body><h2>사각형 생성 삭제하기</h2><hr/><p>
지도위에 사각형 도형을 생성 삭제 할 수 있습니다.
</p><divclass="map-container"><divclass="map-tool-bar"><buttonid="create-rectangle"class="cs-btn3">사각형 생성하기</button><buttonid="delete-rectangle"class="cs-btn3">사각형 삭제하기</button></div><divid="map"class="map"></div></div></body><scriptsrc="https://www.routo.com/assets/js/jquery-3.6.0.min.js"></script><scriptsrc="https://api.routo.com/v2/maps/map?key=12290cd4-7094-43e8-a936-8819196d0332&callback=initMap"></script><script>$(function(){var map =newrouto.maps.Map("map",{center:{lat:37.507009,lng:127.0586339},// 지도 초기 위치zoom:18,// 지도 로딩 시 최초 표시 레벨});var rectangle =null;$("#create-rectangle").click(function(){
rectangle =newrouto.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;});});</script></html>