Regd more than one instances of cesium globe.

Hello,

You will need to create a new Cesium.Viewer(‘containerId’) once for each globe.

You can see an example here: http://analyticalgraphicsinc.github.io/cesium-google-earth-examples/demos/multiple/

And the code for that example can be found here: https://github.com/AnalyticalGraphicsInc/cesium-google-earth-examples/blob/master/demos/multiple/index.html

Best,

Hannah

Thanks you so much for the quick response.
Also is it possible to use same control for 2 globes, like rotating one rotates the another so the we can compare 2 globes with different imagery layers?

Thanks you.

That gets a little more difficult. It’s pretty easy to have one-way control, where you move viewer1 and then make viewer2 move also. I unfortunately don’t have a good solution for making this work both ways.

Here’s an example for a master/slave globe:

var slaveViewer = new Cesium.Viewer(‘cesiumContainerTop’, {
sceneMode : Cesium.SceneMode.SCENE2D
});
var masterViewer = new Cesium.Viewer(‘cesiumContainerBottom’);

ar masterCamera = masterViewer.scene.camera;
var slaveCamera = slaveViewer.scene.camera;

slaveViewer.scene.preRender.addEventListener(function(){
if(slaveViewer.scene.mode !== Cesium.SceneMode.MORPHING){
slaveCamera.setView({
destination : masterCamera.positionWC,
orientation: {
heading : masterCamera.heading,
pitch : masterCamera.pitch,
roll : masterCamera.roll
}
});
}
});

``

Best,

Hannah

I am again stuck for the 2D view as is not working properly in one way control. The camera view is different in slave view than master view.

Please help!

TIA!

Hello,

I believe you are running into this bug: https://github.com/AnalyticalGraphicsInc/cesium/issues/3845

Sorry, but I don’t have a good workaround until we fix that issue. I’ve added a link to your comment so we can notify you when we have a chance to look at it.

Best,

Hannah

Hey Hannah,

As usual thanks for your quick response.
I am facing issue while zooming the map, when I zoom in/out the slave map doesn't zoom in/out in the same proportion?
I am trying with below code which was given in the workaround section and does not use positionWC.

if(slaveViewer.scene.mode == Cesium.SceneMode.COLUMBUS_VIEW ||
           slaveViewer.scene.mode == Cesium.SceneMode.SCENE2D){
var cartographicMaster = masterViewer.scene.mapProjection.unproject(masterCamera.position);

var positionMaster = masterViewer.scene.mapProjection.ellipsoid.cartographicToCartesian(cartographicMaster);

   slaveCamera.setView({
       destination: positionMaster.clone()
      });
}

Thanks!