How to add multiple WMS layer on viewer

I have several WMS layer in geoserver that I want to add them into cesium globe

but I want to add them on cesium viewer ( I have bingmaps key)

can anyone help me to solve this?

Thanks :smiley:

Have a look at the Sandcastle demos, in particular “Imagery Layers” (http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Imagery%20Layers.html&label=Showcases) and “Imagery Layer Manipulation”. While this example uses a CesiumWidget, little changes when using the Viewer widget:

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

var layers = viewer.scene.imageryLayers;

Alex

I see, thanks for that sir…

But sir, I want to add more than one WMS layer on the globe

and btw this example doesn’t work

the firebug wrote : TypeError: widget.centralBody.getImageryLayers is not a function

when I use your example : var layers = viewer.scene.imageryLayers;

firebug detected : TypeError: layers is undefined

Alex

I see, thanks for that sir…

But sir, I want to add more than one WMS layer on the globe

and btw this example doesn’t work

the firebug wrote : TypeError: widget.centralBody.getImageryLayers is not a function

when I use your example : var layers = viewer.scene.imageryLayers;

firebug detected : TypeError: layers is undefined

Have a look at the Sandcastle demos, in particular “Imagery Layers” (http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Imagery%20Layers.html&label=Showcases) and “Imagery Layer Manipulation”. While this example uses a CesiumWidget, little changes when using the Viewer widget:

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

var layers = viewer.scene.imageryLayers;

Alex

I have several WMS layer in geoserver that I want to add them into cesium globe

but I want to add them on cesium viewer ( I have bingmaps key)

can anyone help me to solve this?

Thanks :smiley:

Hi Nakula,
Does the Imagery Layers Sandcastle example work if you change the CesiumWidget to a Viewer widget? Note that if you only change the widget type and nothing else, you’ll see an error reported while constructing the object as you cannot initialize the Viewer widget with an imagery layer without also disabling the baseLayerPicker:

var widget = new Cesium.Viewer('cesiumContainer', { 
    baseLayerPicker : false, 
    imageryProvider : new Cesium.ArcGisMapServerImageryProvider({ 
        url : '//[server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer](http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer)' 
    }) 
}); 

You’ll see that in this sand castle example, it shows two imagery providers. Don’t forget to also look at http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Imagery%20Layers%20Manipulation.html&label=Showcases that demonstrates how to layer multiple imagery layers.

Regarding the TypeError: widget.centralBody.getImageryLayers is not a function, we’ve been making breaking changes recently in an effort to stablize the API for a 1.0. In that particular case, centralBody is not called globe and we no longer use setter/getter methods in favor of javascript properties.

Ah I see, the problem is on the baselayerpicker

It’s working now

Thanks so much sir… :smiley: