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

    <tfoot id='4SBeo'></tfoot>

        <bdo id='4SBeo'></bdo><ul id='4SBeo'></ul>

    1. <small id='4SBeo'></small><noframes id='4SBeo'>

      <legend id='4SBeo'><style id='4SBeo'><dir id='4SBeo'><q id='4SBeo'></q></dir></style></legend>
      <i id='4SBeo'><tr id='4SBeo'><dt id='4SBeo'><q id='4SBeo'><span id='4SBeo'><b id='4SBeo'><form id='4SBeo'><ins id='4SBeo'></ins><ul id='4SBeo'></ul><sub id='4SBeo'></sub></form><legend id='4SBeo'></legend><bdo id='4SBeo'><pre id='4SBeo'><center id='4SBeo'></center></pre></bdo></b><th id='4SBeo'></th></span></q></dt></tr></i><div class="kkugs0i" id='4SBeo'><tfoot id='4SBeo'></tfoot><dl id='4SBeo'><fieldset id='4SBeo'></fieldset></dl></div>
      1. 從 Leaflet.js 地圖添加/刪除 L.control

        Adding/removing L.control from leaflet.js map(從 Leaflet.js 地圖添加/刪除 L.control)

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

        2. <tfoot id='ys6Gj'></tfoot>
          • <bdo id='ys6Gj'></bdo><ul id='ys6Gj'></ul>

                <tbody id='ys6Gj'></tbody>
              <legend id='ys6Gj'><style id='ys6Gj'><dir id='ys6Gj'><q id='ys6Gj'></q></dir></style></legend>
                1. <small id='ys6Gj'></small><noframes id='ys6Gj'>

                2. 本文介紹了從 Leaflet.js 地圖添加/刪除 L.control的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一張基于四個單選按鈕更改圖塊的地圖.我需要在您滾動圖塊時出現的彈出窗口,以便隨著不同地圖圖層的變化而變化.我已經讓它出現了,但是當我切換圖層時,地圖只會添加另一個彈出窗口.我嘗試使用 control.removeFrom(map) 但它似乎不起作用.我想我的邏輯可能在某個地方搞砸了.這是 if 語句之一:

                  I have a map that changes tiles based on four radio buttons. I need the popup window that appears when you roll over a tile to change as the different map layers change. I've gotten it to appear but when I switch layers the map just adds another popup window. I tried using control.removeFrom(map) but it doesn't seem to work. I think my logic may be screwed up somewhere. Here is one of the if statements:

                  if (two == true && black == true) { 
                                  function blkNineStyle(feature) {
                                      return {
                                      fillColor: getColor(feature.properties.pctBlack9000),
                                      weight: 2,
                                      opacity: 1,
                                      color: '#666',
                                      dashArray: '2',
                                      fillOpacity: 0.9
                                      };
                                  }
                                                      //Tried to us this to take off the control.
                                  info.removeFrom(map);
                                  map.removeLayer(geojson);
                                  geojson = L.geoJson(tracts, {style: blkNineStyle, onEachFeature: onEachFeature}).addTo(map);
                  
                                  var info = L.control();
                  
                                  info.onAdd = function (map) {
                                      this._div = L.DomUtil.create('div', 'info');
                                      this.update();
                                      return this._div;
                                  };
                  
                                  info.update = function (props) {
                                      this._div.innerHTML = '<h4>Percent White population change</h4>' + (props ? '<b>' + props.name + '</b><br />' + props.pctBlack9000 + '%' : 'Hover over a tract');
                                  };
                  
                                  info.addTo(map);
                              }
                  

                  您可以在這里查看(損壞的)地圖.

                  推薦答案

                  我自己也遇到了同樣的問題,我剛剛解決了.

                  I had this same problem myself and I just solved it.

                  我必須在全局環境中定義一個空變量(在您使用的任何函數之外).這不是一個完整的腳本或任何東西,但我描述的總體思路如下:

                  I had to define an empty variable in the global environment (outside any functions you're using). This isn't a full script or anything, but the general idea I'm describing is below:

                      var info;  // CREATING INFO VARIABLE IN GLOBAL ENVIRONMENT
                      function makeMap() {
                      ..... geojsons, styles, other stuff ....
                  
                      // REMOVING PREVIOUS INFO BOX
                      if (info != undefined) {
                      info.removeFrom(map)
                      }
                  
                      // making current layer's info box
                      info = L.control();
                  
                      info.onAdd = function (map) {
                      this._div = L.DomUtil.create('div', 'info');
                      this.update();
                      return this._div;
                      };
                  
                      info.update = function (props) {
                      this._div.innerHTML = '<h4>Data by Zip Code</h4>' + (props ?
                      '<b>Zip Code:  ' + props.id + '</b><br />Value:  ' + matchKey(props.id, meanById)
                      : 'Hover over a zip code');
                      };
                  
                      info.addTo(map);
                  
                      ..... other stuff again ......
                  
                      } // end function
                  

                  我對 Leaflet 和 javascript 都很陌生,所以我不得不說我不確定在您提供的地圖鏈接上發布的代碼中的 info.removeFrom(map) 行的位置,但是您與 'info.removeFrom(map)' 走在正確的軌道上.

                  I am very new to both Leaflet and javascript, so I have to say that I'm not exactly sure where to place the info.removeFrom(map) line in the code you have posted at the map link you provided, but you are on the right track with 'info.removeFrom(map)' .

                  我能夠通過在這里擺弄動態圖例和信息框來解決我的問題:http://jsfiddle.net/opensas/TnX96/

                  I was able to problem-solve my issue with dynamic legends and info boxes by fiddling around here: http://jsfiddle.net/opensas/TnX96/

                  這篇關于從 Leaflet.js 地圖添加/刪除 L.control的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 圖層控件添加到側邊欄)

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

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

                          <tbody id='aBQli'></tbody>

                          • <bdo id='aBQli'></bdo><ul id='aBQli'></ul>

                            主站蜘蛛池模板: 太平洋亲子网_健康育儿 品质生活| 猪I型/II型胶原-五克隆合剂-细胞冻存培养基-北京博蕾德科技发展有限公司 | 超声波焊接机_超音波熔接机_超声波塑焊机十大品牌_塑料超声波焊接设备厂家 | 带锯机|木工带锯机圆木推台锯|跑车带锯机|河北茂业机械制造有限公司| | 艾乐贝拉细胞研究中心 | 国家组织工程种子细胞库华南分库 | 防腐储罐_塑料储罐_PE储罐厂家_淄博富邦滚塑防腐设备科技有限公司 | 酶联免疫分析仪-多管旋涡混合仪|混合器-莱普特科学仪器(北京)有限公司 | RTO换向阀_VOC高温阀门_加热炉切断阀_双偏心软密封蝶阀_煤气蝶阀_提升阀-湖北霍科德阀门有限公司 | 颗粒机,颗粒机组,木屑颗粒机-济南劲能机械有限公司 | 粉末包装机,拆包机厂家,价格-上海强牛包装机械设备有限公司 | 薪动-人力资源公司-灵活用工薪资代发-费用结算-残保金优化-北京秒付科技有限公司 | 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 工作心得_读书心得_学习心得_找心得体会范文就上学道文库 | 精密五金冲压件_深圳五金冲压厂_钣金加工厂_五金模具加工-诚瑞丰科技股份有限公司 | 南京种植牙医院【官方挂号】_南京治疗种植牙医院那个好_南京看种植牙哪里好_南京茀莱堡口腔医院 尼龙PA610树脂,尼龙PA612树脂,尼龙PA1010树脂,透明尼龙-谷骐科技【官网】 | 橡胶电子拉力机-塑料-微电脑电子拉力试验机厂家-江苏天源 | 2025第九届世界无人机大会| BHK汞灯-百科|上海熙浩实业有限公司 | 护腰带生产厂家_磁石_医用_热压护腰_登山护膝_背姿矫正带_保健护具_医疗护具-衡水港盛 | 巩义市科瑞仪器有限公司| 钢托盘,铁托盘,钢制托盘,镀锌托盘,饲料托盘,钢托盘制造商-南京飞天金属13260753852 | 猪I型/II型胶原-五克隆合剂-细胞冻存培养基-北京博蕾德科技发展有限公司 | 冷轧机|两肋冷轧机|扁钢冷轧机|倒立式拉丝机|钢筋拔丝机|收线机-巩义市华瑞重工机械制造有限公司 | 网站建设-网站制作-网站设计-网站开发定制公司-网站SEO优化推广-咏熠软件 | 合肥白癜风医院_合肥治疗白癜风医院_合肥看白癜风医院哪家好_合肥华研白癜风医院 | 上海logo设计 | 润滑脂-高温润滑脂-轴承润滑脂-食品级润滑油-索科润滑油脂厂家 | PC构件-PC预制构件-构件设计-建筑预制构件-PC构件厂-锦萧新材料科技(浙江)股份有限公司 | 无锡装修装潢公司,口碑好的装饰装修公司-无锡索美装饰设计工程有限公司 | 山东石英砂过滤器,除氟过滤器「价格低」-淄博胜达水处理 | 聚合氯化铝价格_聚合氯化铝厂家_pac絮凝剂-唐达净水官网 | 建筑资质代办-建筑企业资质代办机构-建筑资质代办公司 | 自动化生产线-自动化装配线-直流电机自动化生产线-东莞市慧百自动化有限公司 | 高扬程排污泵_隔膜泵_磁力泵_节能自吸离心水泵厂家-【上海博洋】 | 餐饮小吃技术培训-火锅串串香培训「何小胖培训」_成都点石成金[官网] | 广州番禺搬家公司_天河黄埔搬家公司_企业工厂搬迁_日式搬家_广州搬家公司_厚道搬迁搬家公司 | 电线电缆厂家|沈阳电缆厂|电线厂|沈阳英联塑力线缆有限公司 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 求是网 - 思想建党 理论强党| 耳模扫描仪-定制耳机设计软件-DLP打印机-asiga打印机-fitshape「飞特西普」 | 折弯机-刨槽机-数控折弯机-数控刨槽机-数控折弯机厂家-深圳豐科机械有限公司 |