How to set layer bing map with labels active

617 views
Skip to first unread message

Dylan Tusler

unread,
Mar 16, 2015, 6:23:32 AM3/16/15
to cesiu...@googlegroups.com
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

        });


Matthew Amato

unread,
Mar 17, 2015, 3:15:45 PM3/17/15
to cesiu...@googlegroups.com
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({
    mapStyle : Cesium.BingMapsStyle.AERIAL_WITH_LABELS
});
var viewer = new Cesium.Viewer('cesiumContainer', {
    animation : false,
    timeline : false,
    baseLayerPicker : false,
    imageryProvider : bing
});

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dylan Tusler

unread,
Mar 17, 2015, 6:06:08 PM3/17/15
to cesiu...@googlegroups.com
I'd like to use the BaseLayerPicker, just default to a different BaseLayer.

Matthew Amato

unread,
Mar 18, 2015, 5:24:30 PM3/18/15
to cesiu...@googlegroups.com
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.

Dylan Tusler

unread,
Mar 18, 2015, 9:07:59 PM3/18/15
to cesiu...@googlegroups.com
That's perfect, thanks.
Reply all
Reply to author
Forward
0 new messages