alberto-acevedo / cesium-navigation

Cesium plugin that adds to the Cesium map a compass, navigator (zoom in/out), and distance scale.
301 stars 124 forks source link

distance legend wrong #7

Open Larcius opened 8 years ago

Larcius commented 8 years ago

distance legend shows wrong values. for example, when in columbus mode with a top down view rotation yields a change in the distance legend (with huge differences). on the other hand in 2d mode there is no legend at all.

does it even make sense to offer this feature because when in columbus or 3d mode the distance varies a lot depending on the depth of the view. the only reasonable solution would be to meassure the distance exactly at the place where the legend appears or to only show it when in top down view with small scale (because in large scales even in 2d the distances are varying a lot).

alberto-acevedo commented 8 years ago

Larcius,

The distance layer is based on the distance in meters of 1 pixel located at the bottom center of the view. The displayed value chosen from a predefined list of distance values is the first distance that divided by the pixel distance gives a ratio of under 100. I think in 3D the distance legend values give a close approximation to the real value of the scale at the current camera altitude. I tested in Columbus view and I see the wrong values you mentioned when rotating the map. I need to investigate how to take into account the rotation of the camera when calculating the pixel distance. I suspect the calculations apply only to 3D (ellipsoid) I'm having similar issues in another project when calculating the bounds or extent of the visible view of the 3D map. The bounds calculated using the Cesium rectangle is wrong when the map is rotated.

In 2D mode the distance scale is disabled by design (Terriajs).