Hi,

I have the following problem. I know it is more related to geo calculation, projection, etc, however I have not found anywhere a solution.

I am using 2D mode view (*Cesium.SceneMode.SCENE2D*) that I rotate.

I want to know what height over ellipsoid I shall pass to *camera.setView* function to see the map that has specified range in X or Y axis (for example 20 km long in horizontal)

Without rotation(i.e. looking North), I figured it out by experimenting (as I lack knowledge on the topic) , that the height is equal to vertical length of the map and the horizontal length is equal to vertical distance * cos(lat).

The problem starts when I apply rotation, as I do not know what calculation is used, i.e. what is the relation between height and lon, lat coordinates passed to setView and the vertical length and horizontal lenfth of my map.

Can someone help me developed the required formula:

INPUT:

lon, lat of camera

heading

map witdth, height in pixels

range of view in meters (in horizontal or verical)

OUTPUT

height I shall pass to camera.setView

viewer.camera.setView({

destination: Cesium.Cartesian3.fromDegrees(lon, lat, HEIGHT ???),

orientation: {

heading: heading,

pitch: -90, // top-down

roll: 0

}

});

Marcin