Hi I want to be able to customize the imagery layers shown in the default viewer's baselayerpicker.
I tried the example here:
https://cesiumjs.org/Cesium/Build/Documentation/BaseLayerPicker.html
However realized that required using cesiumwidget instead of the viewer. So when I added the viewer, I had 2 baselayerpickers.
I want to initialize cesium with the following snippet:
var viewer = new Cesium.Viewer('cesiumContainer',
{baseLayerPicker : true,
animation: false,
timeline:false}
);
but be able to choose myself which imagery layers are shown in the baselayerpicker.
Additionally, how would I choose a default imagery layer among the ones I picked?
Viewer has constructor options to allow you to specify the array of imageryProviderViewModels as well as the selectedImageryProviderViewModel. Consult the documentation:
https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html
Cesium Viewer has constructor options for this, called “imageryProviderViewModels” (an array) and “selectedTerrainProviderViewModel” (which should be a reference to a single element in that array).
There’s also a helper function to create the default array of imagery sources, if you need them:
var imagerySources = Cesium.createDefaultImageryProviderViewModels();
You can modify this array, or create your own array from scratch, following the example set by createDefaultImageryProviderViewModels.
You then create the viewer, passing in the array and a reference to the selected element in the array:
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProviderViewModels : imagerySources,
selectedImageryProviderViewModel : imagerySources[2]
});
--Ed.