久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='drmFK'></bdo><ul id='drmFK'></ul>
  1. <legend id='drmFK'><style id='drmFK'><dir id='drmFK'><q id='drmFK'></q></dir></style></legend>

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

      <tfoot id='drmFK'></tfoot>

      <i id='drmFK'><tr id='drmFK'><dt id='drmFK'><q id='drmFK'><span id='drmFK'><b id='drmFK'><form id='drmFK'><ins id='drmFK'></ins><ul id='drmFK'></ul><sub id='drmFK'></sub></form><legend id='drmFK'></legend><bdo id='drmFK'><pre id='drmFK'><center id='drmFK'></center></pre></bdo></b><th id='drmFK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='drmFK'><tfoot id='drmFK'></tfoot><dl id='drmFK'><fieldset id='drmFK'></fieldset></dl></div>
    1. 如何使用leaflet.js 在多個地圖圖例之間切換?

      How to switch between multiple map legends with leaflet.js?(如何使用leaflet.js 在多個地圖圖例之間切換?)
      <tfoot id='Kpi8I'></tfoot>
        <tbody id='Kpi8I'></tbody>

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

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

              1. 本文介紹了如何使用leaflet.js 在多個地圖圖例之間切換?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在使用leaflet.js 庫根據統計數據創建多個地圖.每個地圖顯示不同的值范圍,因此當用戶更改地圖時更改圖例會很好.

                I`m using leaflet.js library to create multiple maps based on statistical data. Each map displays different range of values so it would be nice to change legend when user change map.

                我在這個問題中找到了類似的例子,但我需要在兩個以上的層之間切換.我嘗試在代碼中簡單地添加更多if"語句和邏輯運算符,但它不能正常工作:

                I found similar example in this question, but I need to switch between more than two layers. I try simply add more "if" statments and logical operators in code, but it doesn`t work right:

                map.on('baselayerchange', function (eventLayer) {
                    if (eventLayer.name === 'Agricultural') {
                        map.removeControl(VODlegend || BUDlegend || LISlegend);
                        SGlegend.addTo(map);
                    }
                    else if  (eventLayer.name === 'Building') {
                        map.removeControl(SGlegend || LISlegend || VODlegend);
                        BUDlegend.addTo(map);
                    }
                    else if  (eventLayer.name === 'Forest') {
                        map.removeControl(BUDlegend || VODlegend || SGlegend);
                        LISlegend.addTo(map);
                    }
                    else if  (eventLayer.name === 'Water') {
                        map.removeControl(LISlegend || SGlegend || BUDlegend);
                        VODlegend.addTo(map);
                    }
                  })
                

                這是我在 jsfiddle 上的地圖示例.如果有任何幫助,我將不勝感激.

                Here is example of my map on jsfiddle. I would be grateful for any help.

                推薦答案

                視頻傳奇 ||BUD傳奇 ||LIS傳奇

                VODlegend || BUDlegend || LISlegend

                在 javascript 中,這是一個條件(結果為真或假)...不是您期望的列表

                In javascript, this is a condition (result is true or false) ... not a list as you expect

                你需要像這樣跟蹤你當前的控件

                You need to keep track of your current control like that

                SGlegend.addTo(map);
                currentLegend = SGlegend;
                
                
                map.on('baselayerchange', function (eventLayer) {
                    if (eventLayer.name === 'Agricultural') {
                        map.removeControl(currentLegend );
                        currentLegend = SGlegend;
                        SGlegend.addTo(map);
                    }
                    else if  (eventLayer.name === 'Building') {
                        map.removeControl(currentLegend );
                        currentLegend = BUDlegend;
                        BUDlegend.addTo(map);
                    }
                    else if  (eventLayer.name === 'Forest') {
                       map.removeControl(currentLegend );
                        currentLegend = LISlegend;
                        LISlegend.addTo(map);
                    }
                    else if  (eventLayer.name === 'Water') {
                       map.removeControl(currentLegend );
                        currentLegend = VODlegend;
                       VODlegend.addTo(map);
                    }
                  })
                

                修改后的小提琴在這里:http://jsfiddle.net/FranceImage/X678g/

                Modified fiddle is here: http://jsfiddle.net/FranceImage/X678g/

                這篇關于如何使用leaflet.js 在多個地圖圖例之間切換?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 圖層控件添加到側邊欄)

                  <tfoot id='8fXjL'></tfoot>
                    <bdo id='8fXjL'></bdo><ul id='8fXjL'></ul>
                      <tbody id='8fXjL'></tbody>
                  • <small id='8fXjL'></small><noframes id='8fXjL'>

                      1. <legend id='8fXjL'><style id='8fXjL'><dir id='8fXjL'><q id='8fXjL'></q></dir></style></legend>

                          <i id='8fXjL'><tr id='8fXjL'><dt id='8fXjL'><q id='8fXjL'><span id='8fXjL'><b id='8fXjL'><form id='8fXjL'><ins id='8fXjL'></ins><ul id='8fXjL'></ul><sub id='8fXjL'></sub></form><legend id='8fXjL'></legend><bdo id='8fXjL'><pre id='8fXjL'><center id='8fXjL'></center></pre></bdo></b><th id='8fXjL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8fXjL'><tfoot id='8fXjL'></tfoot><dl id='8fXjL'><fieldset id='8fXjL'></fieldset></dl></div>
                          主站蜘蛛池模板: 狠狠操狠狠操 | 国产精品久久久久久久免费观看 | 国产一区二区三区四区五区3d | 亚洲精品乱码久久久久v最新版 | 国产色片在线 | 日日摸夜夜添夜夜添精品视频 | 日韩中文字幕在线观看视频 | 夜夜爽夜夜操 | 麻豆一区二区三区精品视频 | 久久久999国产精品 中文字幕在线精品 | 91网站在线看 | 日韩精品av一区二区三区 | av一区二区在线观看 | 欧美精品片 | 一呦二呦三呦国产精品 | 99精品久久99久久久久 | 成人小视频在线观看 | 一级毛片视频在线观看 | 在线一区二区三区 | 久久激情网 | 日本免费一区二区三区四区 | 国产精品亚洲第一 | 视频在线观看一区 | 欧美成人免费在线视频 | 国产一级网站 | 国产分类视频 | 午夜国产 | 91精品国产乱码久久久久久 | av激情在线 | 日本欧美大片 | 91高清免费观看 | 中文字幕欧美一区二区 | 精品91久久久 | 九九99久久 | 国产美女在线免费观看 | 日韩电影一区二区三区 | 国产精品一区二区三区在线 | 精品入口麻豆88视频 | 国产成人亚洲精品 | 91一区二区 | 国产情侣在线看 |