1. A concise explanation of the problem you’re experiencing.
We are experiencing issues when using the FlyTo() function on the viewer if the datasource contains a single entity which is a point at zero elevation (Z). The data is loaded using the CZML format (CzmlDataSource), and the standard FlyTo() function is used on the entities of the datasource, which in this case is a point geometry. We are having issues in both 2D / 3D modes:
2D Mode:
We get a developer error causing cesium to crash:
DeveloperError: right must be greater than left.
``
3D Mode:
The camera actually zooms in way too far…
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
This can be easily reproduced. I’ve attached a demo.czml file containing a single point geometry.
viewer.flyTo(source.entities)
``
Or alternatively in Sandcastle (camera section):
function flyToLocation() {
Sandcastle.declare(flyToLocation);
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(25.0931782016227, - 28.999510764784763)
});
}
``
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
We need a generic function that would zoom to the bounds of a datasource that works well in 2D and 3D mode. Also, all our geometries are drawn with no elevation and has a height of zero. Is there perhaps a function we can call that gets the bounding spheres of all the entities efficiently, hence using the camera with FlyToBoundingSphere() instead? What I like about the bounding sphere is that it internally checks and sets the minimum z to a 100, if the radius is zero or less. The function also yields much better results (based on the frustum far / near) on small points / polygons and larger ones, and is very consistent.
4. The Cesium version you’re using, your operating system and browser.
1.38
demo.czml (331 Bytes)