0
点赞
收藏
分享

微信扫一扫

mapbox 层级控制的两种方式

代码小姐 2022-05-24 阅读 54

mapbox 控制layer 层级方式


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


  • 使用beforeId,在创建图层的时候控制图层的层级


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


  • 使用moveLayer方式


举报

相关推荐

0 条评论