一、定位
this.map.jumpTo({
center: city.geometry.coordinates });
}, 2000 * index);
this.map.flyTo({
center: [114.23774842192483, 30.52603116857425],
essential: true
})
二、获取所有图层
var layers = this.map.getStyle().layers
三、监听地图缩放事件
this.map.on('moveend', () => {
console.log(this.map.getZoom())
})
四、鹰眼
this.map.addControl(
new mapboxgl.Minimap({
id: 'mapboxgl-minimap',
width: '320px',
height: '180px',
style: 'mapbox://styles/tyy-sj/ck9c4cqa301rg1ipfeaiywr9x',
center: [114.23774842192483, 30.52603116857425],
zoom: 15,