[Bug] Cannot dynamically alternate between terrain ON/OFF
Description
We are attempting to alternate dynamically between two modes of visualization, one with terrain ON and another one with terrain OFF.
We are using mapbox as our base map and we are adding some content using the MapboxOverlay in non-interleaved mode.
We are using the TerrainLayer and the experimental TerrainExtension to "drape" the content to the terrain.
Regardless of the fact that mapbox and deck do not match completely (we are aware of that and we are disregarding that issue at the moment), we are unable to alternate between those two modes of terrain ON/OFF.
Flavors
- [ ] Script tag
- [ ] React
- [ ] Python/Jupyter notebook
- [X] MapboxOverlay
- [ ] GoogleMapsOverlay
- [ ] CartoLayer
- [ ] ArcGIS
Expected Behavior
We would expect to be able to switch between terrain ON/OFF using one of the following approaches or a combination of them:
- Toggle
TerrainLayervisibility - Adding/removing
TerrainLayer - Adding/removing
TerrainExtensionfrom the layers (either by redefining the layers or by cloning them)
Steps to Reproduce
In the above DEMO we are displaying the same content with mapbox and deck (using different styles). And there is a button to toggle between Terrain ON/OFF modes.
The deck layers are not visible when trying to start in the "Terrain ON" mode. START_WITH_TERRAIN= true . Alternating does nothing.
The deck content is not draped and it is also cropped when starting in the Terrain OFF mode and alternating to Terrain ON mode.
Environment
- Framework version: [email protected]
- Browser: Chrome 120.0
- OS: Ubuntu 22.04.3 LTS
Logs
No response
We found an alternative that works.
Adding/removing the TerrainLayer and replacing the layers by clones with or without the TerrainExtension does not work, but if we create a new MapboxOverlay instance and use it to replace the previous one when toggling between terrain ON/OFF, then it works.
Here is a working demo.
I haven't found any place in the documentation that makes is clear that we cannot change extensions once the overlay instance is created. Maybe it would make sense to add it somewhere?