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="rqsrchx" 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="axzu3su" id='3wBdP'><tfoot id='3wBdP'></tfoot><dl id='3wBdP'><fieldset id='3wBdP'></fieldset></dl></div>

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

                問題描述

                有沒有辦法使用 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.
                });
                

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

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

                現(xiàn)場演示:

                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>

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

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

                相關(guān)文檔推薦

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

                    <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="jiaznel" 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'>

                        • 主站蜘蛛池模板: 中细软知识产权_专业知识产权解决方案提供商| 西点培训学校_法式西点培训班_西点师培训_西点蛋糕培训-广州烘趣西点烘焙培训学院 | 建筑资质代办_工程施工资质办理_资质代办公司_北京众聚企服 | 隧道风机_DWEX边墙风机_SDS射流风机-绍兴市上虞科瑞风机有限公司 | 液氨泵,液化气泵-淄博「亚泰」燃气设备制造有限公司 | 聚氨酯复合板保温板厂家_廊坊华宇创新科技有限公司 | 胃口福饺子加盟官网_新鲜现包饺子云吞加盟 - 【胃口福唯一官网】 | 棕刚玉_白刚玉_铝酸钙-锐石新材料| 电地暖-电采暖-发热膜-石墨烯电热膜品牌加盟-暖季地暖厂家 | 旅游规划_旅游策划_乡村旅游规划_景区规划设计_旅游规划设计公司-北京绿道联合旅游规划设计有限公司 | 加热制冷恒温循环器-加热制冷循环油浴-杭州庚雨仪器有限公司 | 北京宣传片拍摄_产品宣传片拍摄_宣传片制作公司-现像传媒 | Copeland/谷轮压缩机,谷轮半封闭压缩机,谷轮涡旋压缩机,型号规格,技术参数,尺寸图片,价格经销商 CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | CE认证_产品欧盟ROHS-REACH检测机构-商通检测 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | 洛阳永磁工业大吊扇研发生产-工厂通风降温解决方案提供商-中实洛阳环境科技有限公司 | 上海电子秤厂家,电子秤厂家价格,上海吊秤厂家,吊秤供应价格-上海佳宜电子科技有限公司 | 大立教育官网-一级建造师培训-二级建造师培训-造价工程师-安全工程师-监理工程师考试培训 | 福州仿石漆加盟_福建仿石漆厂家-外墙仿石漆加盟推荐铁壁金钢(福建)新材料科技有限公司有保障 | 安全,主动,被动,柔性,山体滑坡,sns,钢丝绳,边坡,防护网,护栏网,围栏,栏杆,栅栏,厂家 - 护栏网防护网生产厂家 | 高清视频编码器,4K音视频编解码器,直播编码器,流媒体服务器,深圳海威视讯技术有限公司 | 江苏密集柜_电动_手动_移动_盛隆柜业江苏档案密集柜厂家 | 撕碎机_轮胎破碎机_粉碎机_回收生产线厂家_东莞华达机械有限公司 | uv固化机-丝印uv机-工业烤箱-五金蚀刻机-分拣输送机 - 保定市丰辉机械设备制造有限公司 | 广东燎了网络科技有限公司官网-网站建设-珠海网络推广-高端营销型外贸网站建设-珠海专业h5建站公司「了了网」 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 | 地图标注-手机导航电子地图如何标注-房地产商场地图标记【DiTuBiaoZhu.net】 | 深圳美安可自动化设备有限公司,喷码机,定制喷码机,二维码喷码机,深圳喷码机,纸箱喷码机,东莞喷码机 UV喷码机,日期喷码机,鸡蛋喷码机,管芯喷码机,管内壁喷码机,喷码机厂家 | 运动木地板_体育木地板_篮球馆木地板_舞台木地板-实木运动地板厂家 | 无菌检查集菌仪,微生物限度仪器-苏州长留仪器百科 | 汽车整车综合环境舱_军标砂尘_盐雾试验室试验箱-无锡苏南试验设备有限公司 | 时代北利离心机,实验室离心机,医用离心机,低速离心机DT5-2,美国SKC采样泵-上海京工实业有限公司 工业电炉,台车式电炉_厂家-淄博申华工业电炉有限公司 | 红立方品牌应急包/急救包加盟,小成本好项目代理_应急/消防/户外用品加盟_应急好项目加盟_新奇特项目招商 - 中红方宁(北京) 供应链有限公司 | 净化车间装修_合肥厂房无尘室设计_合肥工厂洁净工程装修公司-安徽盛世和居装饰 | 手术示教系统-数字化手术室系统-林之硕医疗云智能视频平台 | 滑石粉,滑石粉厂家,超细滑石粉-莱州圣凯滑石有限公司 | 媒介云-全网整合营销_成都新闻媒体发稿_软文发布平台 | 空气能采暖,热泵烘干机,空气源热水机组|设备|厂家,东莞高温热泵_正旭新能源 | 河南mpp电力管_mpp电力管生产厂家_mpp电力电缆保护管价格 - 河南晨翀实业 | 雷达液位计_超声波风速风向仪_雨量传感器_辐射传感器-山东风途物联网 | 热回收盐水机组-反应釜冷水机组-高低温冷水机组-北京蓝海神骏科技有限公司 |