我在地图初始化中设置了自定义样式 url。喜欢 :
<Mapbox.MapView
styleURL="asset://mystyle.json"
logoEnabled={false}
attributionEnabled={false}
ref={(e) => { this.oMap = e }}
animate={true}
zoomLevel={6}
centerCoordinate={[54.0, 24.0]}
style={{ flex: 1 }}
showUserLocation={true}>
</Mapbox.MapView>
在 mystyle.json 我有两个底图如下:
{
"id": "Satellite",
"type": "raster",
"source": "Satellite",
"layout": {
"visibility": "visible"
},
"paint": {
"raster-opacity": 1
}
},
{
"id": "Satellite2",
"type": "raster",
"source": "Satellite",
"layout": {
"visibility": "none"
},
"paint": {
"raster-opacity": 1
}
}
卫星默认可见。
如何在运行时将卫星属性的可见性设置为无,将卫星 2 的可见性设置为可见?
地图框 gl :
"@mapbox/react-native-mapbox-gl": "^6.1.3"
反应原生:
"react-native": "0.58.9",