1. A concise explanation of the problem you’re experiencing.
While trying to code a basic imagery layer switcher (OpenStreetMap and BingAearial at the moment) layer 0 at North Pole shows up in front of the top layer (layer 1); switching layers (0 with 1) and moving closer to the pole it happens again (please see attached screenshots).
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
In Sandcastle:
HTML Tab:
JS Code Tab:
var osm = Cesium.createOpenStreetMapImageryProvider({
url : ‘https://a.tile.openstreetmap.org/’
});
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
imageryProvider : osm
});
var imageryLayers = viewer.imageryLayers;
var osmLayer = imageryLayers.get(0);
var bingAerialLayer = imageryLayers.addImageryProvider(Cesium.createWorldImagery());
imageryLayers.raiseToTop(bingAerialLayer);
Sandcastle.addToolbarMenu([{
text : ‘Bing Aerial’,
onselect : function() {
imageryLayers.raiseToTop(bingAerialLayer);
}
}, {
text : ‘OpenStreetMap’,
onselect : function() {
imageryLayers.raiseToTop(osmLayer);
}
}], ‘layerSwitcher’);
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I have to code a basic map switcher (OSM and Bing for now). Is there a better way to accomplish that (the map switching) with Cesium without incurring in such an issue?
4. The Cesium version you’re using, your operating system and browser.
Cesium 1.50, Windows 7, Chrome Version 69.0.3497.100 (Official Build) (64-bit)
Thanks