How to add multiple WMS layer on viewer

1,251 views
Skip to first unread message

Nakula Fisher

unread,
May 9, 2014, 3:04:15 AM5/9/14
to cesiu...@googlegroups.com
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 :D

Alexander Wood

unread,
May 9, 2014, 7:05:19 AM5/9/14
to cesiu...@googlegroups.com
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

Nakula Fisher

unread,
May 11, 2014, 2:01:18 PM5/11/14
to cesiu...@googlegroups.com
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
Message has been deleted

Alexander Wood

unread,
May 12, 2014, 7:02:58 AM5/12/14
to cesiu...@googlegroups.com
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
        }) 
    }); 

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. 

Alex
Message has been deleted

Nakula Fisher

unread,
May 13, 2014, 5:30:54 PM5/13/14
to cesiu...@googlegroups.com
Ah I see, the problem is on the baselayerpicker

It's working now

Thanks so much sir... :D
Reply all
Reply to author
Forward
0 new messages