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

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

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

      <legend id='MAJAv'><style id='MAJAv'><dir id='MAJAv'><q id='MAJAv'></q></dir></style></legend>

          <bdo id='MAJAv'></bdo><ul id='MAJAv'></ul>

        傳單:使用 CircleMarkers 包含元數據

        Leaflet: Including metadata with CircleMarkers(傳單:使用 CircleMarkers 包含元數據)
          <tbody id='NRtuY'></tbody>

              <bdo id='NRtuY'></bdo><ul id='NRtuY'></ul>

                <i id='NRtuY'><tr id='NRtuY'><dt id='NRtuY'><q id='NRtuY'><span id='NRtuY'><b id='NRtuY'><form id='NRtuY'><ins id='NRtuY'></ins><ul id='NRtuY'></ul><sub id='NRtuY'></sub></form><legend id='NRtuY'></legend><bdo id='NRtuY'><pre id='NRtuY'><center id='NRtuY'></center></pre></bdo></b><th id='NRtuY'></th></span></q></dt></tr></i><div class="bbbxt0k" id='NRtuY'><tfoot id='NRtuY'></tfoot><dl id='NRtuY'><fieldset id='NRtuY'></fieldset></dl></div>
              • <small id='NRtuY'></small><noframes id='NRtuY'>

              • <tfoot id='NRtuY'></tfoot>

                1. <legend id='NRtuY'><style id='NRtuY'><dir id='NRtuY'><q id='NRtuY'></q></dir></style></legend>
                  本文介紹了傳單:使用 CircleMarkers 包含元數據的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一張使用 CircleMarkers 填充的傳單地圖.我想在每個圓圈中包含一個附加值(數據庫 ID),這樣當我單擊圓圈時,我可以獲取該值并導航到其他地方.

                  I have a Leaflet map that I am populating with CircleMarkers. I would like to include an additional value (a database ID) with each circle so that when I click on the circle, I can get the value and navigate somewhere else.

                  我想將值直接添加到標記并在整個 featureGroup 上使用回調函數,而不是為每個標記添加回調函數,因為我們要處理超過 500 個標記和這會拖累性能.

                  I would like to add the value directly to the marker and use a callback function on the entire featureGroup instead of adding a callback function to each marker, since we're dealing with over 500 markers and it would be a performance drag.

                  值得一提:我在 Angular 應用程序中使用 Typescript,但它仍然是 Leaflet.

                  Worth mentioning: I'm using Typescript inside an Angular app, but it's still Leaflet.

                  我的嘗試:

                    var data = [
                      {lat: 20.45, lng: -150.2, id: 44},
                      {lat: 23.45, lng: -151.7, id: 45},
                    ]
                    var points = [];
                  
                    data.forEach((d) => {
                      // How do I add an additional variable to this circleMarker?
                      points.push(circleMarker(latLng(d.lat, d.lng), { radius: 5}));
                    })
                  
                    var group = featureGroup(points);
                  
                    group.on("click", function (e) {
                      console.log(e);
                      // This is where I would like to get the ID number of the record
                    });
                  

                  推薦答案

                  FWIW,你有很多方法可以將你自己的數據添加到 Leaflet Layers (沒有特定于圓形標記,標記相同,還有多邊形,折線等).

                  FWIW, you have plenty ways of adding your own data to Leaflet Layers (nothing specific to Circle Markers, it is the same for Markers, but also Polygons, Polylines, etc.).

                  參見例如:Leaflet/Leaflet #5629(將業務數據附加到層)

                  簡而言之,主要有3種可能的方式:

                  In short, there are mainly 3 possible ways:

                  • 在 Leaflet Layer 實例化后直接添加一些屬性即可.確保避免與庫屬性和方法發生沖突.您可以在屬性名稱中添加自己的前綴以減少沖突的機會.
                  var marker = L.marker(latlng);
                  marker.myLibTitle = 'my title';
                  

                  • 使用層 options(通常是實例化工廠的第二個參數),如 @nikoshr 所示.如前所述,避免與庫選項名稱沖突.
                    • Use the Layer options (usually the 2nd argument of the instantiation factory), as shown by @nikoshr. As previously, avoid collision with library option names.
                    • L.marker(latlng, {
                        myLibTitle: 'my title'
                      });
                      

                      • 使用圖層 GeoJSON properties.Leaflet 不會將這些數據用于內部目的,因此您可以完全自由地使用這些數據,沒有任何碰撞風險.
                        • Use the Layer GeoJSON properties. Leaflet does not use those for internal purpose, so you have total freedom of this data, without any risk of collision.
                        • L.Layer.include({
                            getProps: function () {
                              var feature = this.feature = this.feature || {}; // Initialize the feature, if missing.
                              feature.type = 'Feature';
                              feature.properties = feature.properties || {}; // Initialize the properties, if missing.
                              return feature.properties;
                            }
                          });
                          
                          var marker = L.marker(latlng);
                          
                          // set data
                          marker.getProps().myData = 'myValue';
                          
                          // get data
                          myFeatureGroup.on('click', function (event) {
                            var source = event.sourceTarget;
                            console.log(source.getProps().myData);
                          });
                          

                          這篇關于傳單:使用 CircleMarkers 包含元數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='vnqK5'></small><noframes id='vnqK5'>

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

                            <bdo id='vnqK5'></bdo><ul id='vnqK5'></ul>

                          • 主站蜘蛛池模板: 单机除尘器 骨架-脉冲除尘器设备生产厂家-润天环保设备 | 必胜高考网_全国高考备考和志愿填报信息平台 | 临时厕所租赁_玻璃钢厕所租赁_蹲式|坐式厕所出租-北京慧海通 | 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 | 耐火浇注料价格-高强高铝-刚玉碳化硅耐磨浇注料厂家【直销】 | 高温链条油|高温润滑脂|轴承润滑脂|机器人保养用油|干膜润滑剂-东莞卓越化学 | 杭州实验室尾气处理_实验台_实验室家具_杭州秋叶实验设备有限公司 | 生物颗粒燃烧机-生物质燃烧机-热风炉-生物颗粒蒸汽发生器-丽水市久凯能源设备有限公司 | 成都办公室装修-办公室设计-写字楼装修设计-厂房装修-四川和信建筑装饰工程有限公司 | 泰国专线_泰国物流专线_广州到泰国物流公司-泰廊曼国际 | 营养师网,营养师考试时间,报名入口—网站首页 | 真空粉体取样阀,电动楔式闸阀,电动针型阀-耐苛尔(上海)自动化仪表有限公司 | 翻斗式矿车|固定式矿车|曲轨侧卸式矿车|梭式矿车|矿车配件-山东卓力矿车生产厂家 | 上海公众号开发-公众号代运营公司-做公众号的公司企业服务商-咏熠软件 | 南京技嘉环保科技有限公司-杀菌除臭剂|污水|垃圾|厕所|橡胶厂|化工厂|铸造厂除臭剂 | 帽子厂家_帽子工厂_帽子定做_义乌帽厂_帽厂_制帽厂 | 飞行者联盟-飞机模拟机_无人机_低空经济_航空技术交流平台 | 美国HASKEL增压泵-伊莱科elettrotec流量开关-上海方未机械设备有限公司 | 工业铝型材生产厂家_铝合金型材配件批发精加工定制厂商 - 上海岐易铝业 | 杭州ROHS检测仪-XRF测试仪价格-百科| 中医治疗皮肤病_潍坊银康医院「山东」重症皮肤病救治平台 | 淄博不锈钢,淄博不锈钢管,淄博不锈钢板-山东振远合金科技有限公司 | 黑龙江「京科脑康」医院-哈尔滨失眠医院_哈尔滨治疗抑郁症医院_哈尔滨精神心理医院 | 超声骨密度仪-动脉硬化检测仪器-人体成分分析仪厂家/品牌/价格_南京科力悦 | 洗地机-全自动/手推式洗地机-扫地车厂家_扬子清洁设备 | 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 视觉检测设备_自动化检测设备_CCD视觉检测机_外观缺陷检测-瑞智光电 | SMC-ASCO-CKD气缸-FESTO-MAC电磁阀-上海天筹自动化设备官网 | 证券新闻,热播美式保罗1984第二部_腾讯1080p-仁爱影院 | 注塑机-压铸机-塑料注塑机-卧式注塑机-高速注塑机-单缸注塑机厂家-广东联升精密智能装备科技有限公司 | 广州市哲铭油墨涂料有限公司,水性漆生产研发基地 | 搜木网 - 木业全产业链交易平台,免费搜货、低价买货! | 中式装修设计_全屋定制家具_实木仿古门窗花格厂家-喜迎门 | 喷播机厂家_二手喷播机租赁_水泥浆洒布机-河南青山绿水机电设备有限公司 | 科普仪器菏泽市教育教学仪器总厂 | 展厅设计-展馆设计-专业企业展厅展馆设计公司-昆明华文创意 | 防水套管厂家_刚性防水套管_柔性防水套管_不锈钢防水套管-郑州中泰管道 | 电渗析,废酸回收,双极膜-山东天维膜技术有限公司 | 耐磨陶瓷管道_除渣器厂家-淄博浩瀚陶瓷科技有限公司 | 坏男孩影院-提供最新电影_动漫_综艺_电视剧_迅雷免费电影最新观看 | 灰板纸、灰底白、硬纸板等纸品生产商-金泊纸业 |