mapbox 栅格图层处理
增加图层
const layers =
{
'id': layer.id,
'type': layer.type,
'source': {
'type': layer.type,
'tiles':['https://obs-tilemap.obs.cn-north-4.myhuaweicloud.com/tilemap/' + this.timeStamps0 + '/{z}/{z}_{x}_{y}.png'],
},
'minzoom': 0,
'maxzoom': 22,
'zindex': 999,
}
console.log(window.map.getSource(layer.id))
window.map.addLayer(layers)
其中,也可以写成
const layers =
{
'id': layer.id,
'type': layer.type,
'source':layer.id,
'minzoom': 0,
'maxzoom': 22,
'zindex': 999,
}
console.log(window.map.getSource(layer.id))
window.map.addSource(layer.id,
{
'type': layer.type,
'tiles':['https://obs-tilemap.obs.cn-north-4.myhuaweicloud.com/tilemap/' + this.timeStamps0 + '/{z}/{z}_{x}_{y}.png'],
}
) window.map.addLayer(layers)