Selecting already defined imagery and terrain layers

When cesium comes up it already has a bunch of layers defined. Is there a simple way to programmatically change the layers used?

It would seem there’s a mechanism to select an already existing definition by an index or such.


Ken J.

Hello Ken,

Are you trying to programatically select a layer from the base layer picker widget? Here is code to accomplish that:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var baseLayerPickerViewModel = viewer.baseLayerPicker.viewModel;

baseLayerPickerViewModel.selectedImagery = baseLayerPickerViewModel.imageryProviderViewModels[3];




Again, THANK YOU Hannah. Some of this stuff isn’t obvious from the documentation and a quick questions save lots of time.