PositionWC in 2d and Columbus mode

Hi,

I have a problem about the PositionWC in 2d and Columbus mode. When I attempt to run the following code:

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

viewer.camera.moveEnd.addEventListener(function() {
console.log("positionWC: " + viewer.camera.positionWC);
console.log("position: " + viewer.camera.position);
console.log("Cartesian: " + viewer.scene.globe.ellipsoid.cartographicToCartesian(viewer.camera.positionCartographic));
});

The three coordinates are all different in 2d and Columbus mode. So what the definition of positionWC? Why the values between positionWC and the Cartesian coordinate converted from positionCartographic are different?

Thanks a lot~

Hello,

camera.position is the actual position of the camera. This value is different between the three scene modes because it’s relative to the map projection.

camera.positionWC stands for position world coordinates. This value should be the same in 3D, 2D and CV. Also, position and positionWC should have the same value in 3D mode.

If you’re seeing a slightly different value for positionCartographic, it’s likely due to a tiny amount of precision loss from converting between the coordinate systems.

Hope this helps!

Hannah

Hi Hannah,

Thanks for your response, but the values between positionWC and the Cartesian coordinate converted from positionCartographic are quite different in 2D and Columbus mode. The following example data are get from the codes of the first post:

positionWC: (12756274, 4261109.554612936, -2536374.734888654)
Cartesian: (27699581.315460104, 21858702.48189013, -14805005.192263555)

In addition, if I want to reproduce the camera position in 2D and Columbus mode using by the flyTo function, I need to use the Cartesian value. The camera position would be wrong when I used the positionWC value.

Does positionWC value include any bugs? Thanks a lot~

Hannah Pinkos於 2016年7月5日星期二 UTC+8下午10時01分05秒寫道:

Oh, actually we do have a bug open about positionWC in 2D and columbus view: https://github.com/AnalyticalGraphicsInc/cesium/issues/3845
I added a note of your forum post to that issue so we can let you know when we get a chance to look into it.

Best,

Hannah

Hi Hannah,

You answer my doubt and thanks a lot~~

Apologies for resurrecting an old thread, but I am trying to find a better explanation as to why the 2D camera coordinate system is so much different than 3D/CV. The last comment from the issue posted above reads:

positionWC is working as expected after all. “World coordinates” means using the world coordinate system, which is different between 3D, 2D and CV. For example, in 3D Z is north and Y is east. In CV, X is up.

Why is the 2D camera’s X value in world coordinates always 12756274? I would expect it to be more similar to CV, where X directly relates to the camera’s height. This causes some pretty unintuitive behavior with flyTo and setView, as I posted about here: FlyTo final position depends on duration in 2D mode · Issue #12325 · CesiumGS/cesium · GitHub

Any help better understanding why this decision was made would be helpful!