How to set layer bing map with labels active

How can I get the bing map with labels to be the default layer shown when setting up my viewer?

I want the existing default layers to be available, I just want to select a different default selected layer.

Failed attempt:

    var bing = new Cesium.BingMapsImageryProvider({

      url : 'http://dev.virtualearth.net',

      mapStyle : Cesium.BingMapsStyle.AERIAL_WITH_LABELS

    });

    var viewer = new Cesium.Viewer('cesiumContainer', {

      animation: false,

      timeline: false,

      selectedImageryProviderViewModel: bing

    });

This can be a little confusing because there are actually two ways to specify imagery depending on if you are using the baseLayerPicker or not. Try this:

var bing = new Cesium.BingMapsImageryProvider({

url : ‘http://dev.virtualearth.net’,

mapStyle : Cesium.BingMapsStyle.AERIAL_WITH_LABELS

});

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

animation : false,

timeline : false,

baseLayerPicker : false,

imageryProvider : bing

});

I’d like to use the BaseLayerPicker, just default to a different BaseLayer.

There’s a few different ways to do it, but assuming you are using our default collection of view modes, this is probably the easiest way.

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

var baseLayerPickerViewModel = viewer.baseLayerPicker.viewModel;

baseLayerPickerViewModel.selectedImagery = baseLayerPickerViewModel.imageryProviderViewModels[1];

If you are defining your own collection of view models, pass “selectedImageryProviderViewModel” as an option to the Viewer constructor with the view model you want along with imageryProviderViewModels, which is the full set.

1 Like

That’s perfect, thanks.