pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='76uxD'><style id='76uxD'><dir id='76uxD'><q id='76uxD'></q></dir></style></legend>

    1. <tfoot id='76uxD'></tfoot>
      <i id='76uxD'><tr id='76uxD'><dt id='76uxD'><q id='76uxD'><span id='76uxD'><b id='76uxD'><form id='76uxD'><ins id='76uxD'></ins><ul id='76uxD'></ul><sub id='76uxD'></sub></form><legend id='76uxD'></legend><bdo id='76uxD'><pre id='76uxD'><center id='76uxD'></center></pre></bdo></b><th id='76uxD'></th></span></q></dt></tr></i><div class="kiaaeqq" id='76uxD'><tfoot id='76uxD'></tfoot><dl id='76uxD'><fieldset id='76uxD'></fieldset></dl></div>

      <small id='76uxD'></small><noframes id='76uxD'>

        <bdo id='76uxD'></bdo><ul id='76uxD'></ul>

      在 Leaflet L.Draw 插件中以編程方式添加多邊形

      Add Polygon programmatically in Leaflet L.Draw plugin(在 Leaflet L.Draw 插件中以編程方式添加多邊形)
      <legend id='3wBdP'><style id='3wBdP'><dir id='3wBdP'><q id='3wBdP'></q></dir></style></legend>

    2. <small id='3wBdP'></small><noframes id='3wBdP'>

        <tbody id='3wBdP'></tbody>
        • <bdo id='3wBdP'></bdo><ul id='3wBdP'></ul>
            <i id='3wBdP'><tr id='3wBdP'><dt id='3wBdP'><q id='3wBdP'><span id='3wBdP'><b id='3wBdP'><form id='3wBdP'><ins id='3wBdP'></ins><ul id='3wBdP'></ul><sub id='3wBdP'></sub></form><legend id='3wBdP'></legend><bdo id='3wBdP'><pre id='3wBdP'><center id='3wBdP'></center></pre></bdo></b><th id='3wBdP'></th></span></q></dt></tr></i><div class="img8iu6" id='3wBdP'><tfoot id='3wBdP'></tfoot><dl id='3wBdP'><fieldset id='3wBdP'></fieldset></dl></div>

                <tfoot id='3wBdP'></tfoot>
              1. 本文介紹了在 Leaflet L.Draw 插件中以編程方式添加多邊形的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                有沒有辦法使用 Leaflet 繪圖插件以編程方式添加多邊形?https://github.com/Leaflet/Leaflet.draw

                Is there a way to add a polygon programmatically using the Leaflet draw plugin? https://github.com/Leaflet/Leaflet.draw

                例如:點擊一個按鈕,添加一個可以被插件編輯的方塊.

                For example: click a button and add a square that can be edited by the plugin.

                推薦答案

                您只需將多邊形(或任何其他您希望可編輯的圖層)添加到您傳遞給 edit.featureGroup 您的 L.Control.Draw 控件.

                You just need to add your polygon (or whatever other layer that you want to be editable) to the Feature Group that you pass to the edit.featureGroup option of your L.Control.Draw control.

                var editableLayers = L.featureGroup().addTo(map);
                var drawControl = new L.Control.Draw({
                  edit: {
                    featureGroup: editableLayers
                  }
                });
                
                // Add a new editable rectangle when clicking on the button.
                button.addEventListener('click', function (event) {
                  event.preventDefault();
                
                  L.rectangle([
                    getRandomLatLng(),
                    getRandomLatLng()
                  ]).addTo(editableLayers); // Add to editableLayers instead of directly to map.
                });
                

                稍后可以通過單擊編輯圖層"按鈕來編輯該功能組中的所有內容(如果啟用了該功能).

                Everything that is in that Feature Group can later be edited by clicking on the "Edit layers" button (if that functionality is enabled).

                現場演示:

                var map = L.map('map').setView([48.86, 2.35], 11);
                
                var editableLayers = L.featureGroup().addTo(map);
                var drawControl = new L.Control.Draw({
                  edit: {
                    featureGroup: editableLayers
                  },
                  draw: false
                }).addTo(map);
                
                // Add a new editable rectangle when clicking on the button.
                button.addEventListener('click', function(event) {
                  event.preventDefault();
                
                  L.rectangle([
                    getRandomLatLng(),
                    getRandomLatLng()
                  ]).addTo(editableLayers); // Add to editableLayers instead of directly to map.
                });
                
                L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
                  attribution: '&copy; <a >OpenStreetMap</a> contributors'
                }).addTo(map);
                
                function getRandomLatLng() {
                  return [
                    48.8 + 0.1 * Math.random(),
                    2.25 + 0.2 * Math.random()
                  ];
                }

                html,
                body,
                #map {
                  height: 100%;
                  margin: 0;
                }
                
                #button {
                  z-index: 1050;
                  position: absolute;
                  top: 10px;
                  left: 50px;
                }

                <link rel="stylesheet"  integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin="" />
                <script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet-src.js" integrity="sha512-+ZaXMZ7sjFMiCigvm8WjllFy6g3aou3+GZngAtugLzrmPFKFK7yjSri0XnElvCTu/PrifAYQuxZTybAEkA8VOA==" crossorigin=""></script>
                
                <link rel="stylesheet" href="https://unpkg.com/leaflet-draw@1.0.2/dist/leaflet.draw.
                css" />
                <script src="https://unpkg.com/leaflet-draw@1.0.2/dist/leaflet.draw-src.js"></script>
                
                <div id="map"></div>
                
                <button id="button">Add editable rectangle</button>

                這篇關于在 Leaflet L.Draw 插件中以編程方式添加多邊形的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                Trigger click on leaflet marker(觸發點擊傳單標記)
                How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)

                    <i id='VRa4F'><tr id='VRa4F'><dt id='VRa4F'><q id='VRa4F'><span id='VRa4F'><b id='VRa4F'><form id='VRa4F'><ins id='VRa4F'></ins><ul id='VRa4F'></ul><sub id='VRa4F'></sub></form><legend id='VRa4F'></legend><bdo id='VRa4F'><pre id='VRa4F'><center id='VRa4F'></center></pre></bdo></b><th id='VRa4F'></th></span></q></dt></tr></i><div class="wmoyc8c" id='VRa4F'><tfoot id='VRa4F'></tfoot><dl id='VRa4F'><fieldset id='VRa4F'></fieldset></dl></div>

                        <tbody id='VRa4F'></tbody>
                      • <bdo id='VRa4F'></bdo><ul id='VRa4F'></ul>
                        • <tfoot id='VRa4F'></tfoot>
                          <legend id='VRa4F'><style id='VRa4F'><dir id='VRa4F'><q id='VRa4F'></q></dir></style></legend>

                          <small id='VRa4F'></small><noframes id='VRa4F'>

                        • 主站蜘蛛池模板: 色油机-色母机-失重|称重式混料机-称重机-米重机-拌料机-[东莞同锐机械]精密计量科技制造商 | 山东臭氧发生器,臭氧发生器厂家-山东瑞华环保设备 | 臭氧灭菌箱-油桶加热箱-原料桶加热融化烘箱-南京腾阳干燥设备厂 臭氧发生器_臭氧消毒机 - 【同林品牌 实力厂家】 | 微型实验室真空泵-无油干式真空泵-微型涡旋耐腐蚀压缩机-思科涡旋科技(杭州)有限公司 | 金蝶帐无忧|云代账软件|智能财税软件|会计代账公司专用软件 | 3D全息投影_地面互动投影_360度立体投影_水幕灯光秀 | 广东银虎 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 「阿尔法设计官网」工业设计_产品设计_产品外观设计 深圳工业设计公司 | 鹤壁创新仪器公司-全自动量热仪,定硫仪,煤炭测硫仪,灰熔点测定仪,快速自动测氢仪,工业分析仪,煤质化验仪器 | 纸箱抗压机,拉力机,脂肪测定仪,定氮仪-山东德瑞克仪器有限公司 | 高低温试验房-深圳高低温湿热箱-小型高低温冲击试验箱-爱佩试验设备 | 高防护蠕动泵-多通道灌装系统-高防护蠕动泵-www.bjhuiyufluid.com慧宇伟业(北京)流体设备有限公司 | 石磨面粉机|石磨面粉机械|石磨面粉机组|石磨面粉成套设备-河南成立粮油机械有限公司 | 综合管廊模具_生态,阶梯护坡模具_检查井模具制造-致宏模具厂家 | 上海深蓝_缠绕机_缠膜机-上海深蓝机械装备有限公司 | 拉力测试机|材料拉伸试验机|电子拉力机价格|万能试验机厂家|苏州皖仪实验仪器有限公司 | 便民信息网_家电维修,家电清洗,开锁换锁,本地家政公司 | 六维力传感器_三维力传感器_二维力传感器-南京神源生智能科技有限公司 | 反渗透水处理设备|工业零排放|水厂设备|软化水设备|海南净水设备--海南水处理设备厂家 | 青州搬家公司电话_青州搬家公司哪家好「鸿喜」青州搬家 | 一礼通 (www.yilitong.com)-企业礼品解决方案一站式服务平台 | 网络推广公司_网络营销方案策划_企业网络推广外包平台-上海澜推网络 | 课件导航网_ppt课件_课件模板_课件下载_最新课件资源分享发布平台 | 沥青灌缝机_路面灌缝机_道路灌缝机_沥青灌缝机厂家_济宁萨奥机械有限公司 | 烟台游艇培训,威海游艇培训-烟台市邮轮游艇行业协会 | 深圳展厅设计_企业展馆设计_展厅设计公司_数字展厅设计_深圳百艺堂 | 「钾冰晶石」氟铝酸钾_冰晶石_氟铝酸钠「价格用途」-亚铝氟化物厂家 | 两头忙,井下装载机,伸缩臂装载机,30装载机/铲车,50装载机/铲车厂家_价格-莱州巨浪机械有限公司 | 正压密封性测试仪-静态发色仪-导丝头柔软性测试仪-济南恒品机电技术有限公司 | 翅片管换热器「型号全」_厂家-淄博鑫科环保 | 烟台条码打印机_烟台条码扫描器_烟台碳带_烟台数据采集终端_烟台斑马打印机-金鹏电子-金鹏电子 | 耐磨陶瓷管道_除渣器厂家-淄博浩瀚陶瓷科技有限公司 | 智慧钢琴-电钢琴-便携钢琴-数码钢琴-深圳市特伦斯乐器有限公司 | 3D全息投影_地面互动投影_360度立体投影_水幕灯光秀 | 广东银虎 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 新密高铝耐火砖,轻质保温砖价格,浇注料厂家直销-郑州荣盛窑炉耐火材料有限公司 | 碎石机设备-欧版反击破-欧版颚式破碎机(站)厂家_山东奥凯诺机械 高低温试验箱-模拟高低温试验箱订制-北京普桑达仪器科技有限公司【官网】 | 光栅尺_Magnescale探规_磁栅尺_笔式位移传感器_苏州德美达 | 客服外包专业服务商_客服外包中心_网萌科技 | 企业彩铃制作_移动、联通、电信集团彩铃上传开通_彩铃定制_商务彩铃管理平台-集团彩铃网 | 食品机械专用传感器-落料放大器-低价接近开关-菲德自控技术(天津)有限公司 | 一技任务网_有一技之长,就来技术任务网| 沈飞防静电地板__机房地板-深圳市沈飞防静电设备有限公司 |