leaflet 设置图层优先级

Leaflet 在添加了区域、点位等图层之后,需要设置图层的优先级,可以通过 pane 来设置。

 

this.map.createPane('tlop')
this.map.getPane('tlop').style.zIndex = 500
const markers = L.layerGroup()
let marker = L.polygon(latlngs, {
   color: '#0000bf',
   fillColor: '#dada3c',
   fillOpacity: 0.5,
   weight: 2,
   pane: 'tlop' // 注意要在图层上使用 pane options 参数
})
markers.addLayer(marker)

 

 

 

 

posted @ 2023-02-15 10:19  我就尝一口  阅读(306)  评论(0编辑  收藏  举报