Here's some code I use that does a "pretty good" job of solving this problem. This is borrowed heavily from this forum post: http://cesium.agi.com/forum.html?place=msg%2Fcesium-dev%2FjYlLEnyv7lM%2FwUKX0EKUqQQJ.
var c2 = new Cesium.Cartesian2(0, 0);
var leftTop = scene.getCamera().controller.pickEllipsoid(c2, ellipsoid);
c2 = new Cesium.Cartesian2(scene.getCanvas().width, scene.getCanvas().height);
var rightDown = scene.getCamera().controller.pickEllipsoid(c2, ellipsoid);
if (leftTop != null && rightDown != null) { //ignore jslint
leftTop = ellipsoid.cartesianToCartographic(leftTop);
rightDown = ellipsoid.cartesianToCartographic(rightDown);
return new Cesium.Extent(leftTop.longitude, rightDown.latitude, rightDown.longitude, leftTop.latitude);
} else {
//The sky is visible in 3D
return null;
}
As the code comment mentions this does not work if the sky is in view and it may not work for other situations as well so use at your own risk and make sure to test heavily before using in production.
As per my requirement i have to show the placemarks with in the bounding box. The solution for the given by you for earth covering all 4 corners(sky is not in view) is working fine.. but when i tilting or rotating the map in same area where i can see all placemarks i could not get the correct bounding box values as i could see only few placemarks there. Does it need to do something with rotate/tilt angle..?
Could you please help me to get bounding box values after tilting/rotating map.
Thanks,
Raghu.