在mapbox中 指定图层层级 例如让标点置于最上方

1:

initLayer(options, beforeId) {
this.map.addLayer(
{
id: options.id,
type: options.type,
source: options.source,
layout: options.layout,
paint: options.paint,
},
beforeId,
)
},

 

 

2:

if (_this.map.getLayer('markerPoint') && _this.map.getLayer('areaMapFill')) {
_this.map.moveLayer('areaMapFill', 'markerPoint')
_this.map.moveLayer('areaMapLine', 'markerPoint')
}

 

3:/ 层级越高越在上层

paint: {
"fill-opacity": 0.9,
"fill-color": "#00f"
},
metadata:{
zIndex: 1
}

posted @ 2022-04-19 10:55  泽泽生龙  阅读(2046)  评论(0编辑  收藏  举报