Camera setView is not behaving as expected on SceneMode 3D


I’m trying to zoom at the boundaries of a WMS layer. After some searching I found this solution:{

destination: new Cesium.Rectangle.fromDegrees(bbox.left, bbox.bottom, bbox.right,


It works well when the SceneMode is 2D, but on 3D the zoom is larger than expected.

My suspections is that the setView is not considering the spherical projection,

I had a silimilar issue on getting coordinates, but I solved it using a GeographicProjection to calculate the values.




Could you tell me what the coordinates are so we can test? The views I’ve seen line up for most rectangles.



Yes, the coordinates are: west:-45.977340999999605, south: -21.417668000000273, east:-45.96351400000036, north:-21.403251000000008 (WGS84).

Thanks in advance.

Thanks for the additional info. However, I wasn’t able to reproduce this problem. Here is the code example I tested with:

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

var west = -45.977340999999605;
var south = -21.417668000000273;
var east = -45.96351400000036;
var north = -21.403251000000008;
var rectangle = new Cesium.Rectangle.fromDegrees(west, south, east, north);
rectangle : {
coordinates: rectangle,
fill: false,
outline : true,
outlineColor: Cesium.Color.WHITE

Sandcastle.addToolbarButton(‘Set View’, function() {{
destination: rectangle


I added a rectangle so you can see where the bounds are, and the camera includes the whole thing in both 2D and 3D for me. I tried different screen sizes as well and got the same result.

What version of Cesium are you using? Are there any other steps to reproduce the problem?



Oh, sorry I forgot to metion I’m using a terrain provider.

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : ‘//


The problem happens when set it on the viewer.

***Cesium version 1.27

Okay, that makes sense then. The function that finds the camera rectangle doesn’t account for terrain. I’ve filed an issue here for us to consider:



Thanks Hannah.