WGS84.cartesianToCartographic always produces lat, lon between -2 and 2

650 views
Skip to first unread message

Ryan Littlefield

unread,
Jul 9, 2014, 7:13:16 PM7/9/14
to cesiu...@googlegroups.com
Hi everyone,
I'm just starting to play with cesiumjs, and it's been fun to work with so far. I'm hitting a bit of a snag with the cartesianToCartographic function. It seems that no matter what Cartesian3 object I use, it always comes back with a coordinate in a limited range:

var position = new Cesium.Cartesian3(17832.12, 83234.52, 952313.73);
var cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);
console.log(cartographicPosition);

-> longitude1.359747201727748latitude1.4822411860089668height-5400810.410905182

I've tried a bunch of positions, and they all behave the same way once used in cartesianToCartographic:

var position = new Cesium.Cartesian3(221165.310807555, -4771977.925023912, 4055621.463035146);

-> longitude-1.2728364047014729latitude0.7209632254076962height0

I'm sure I'm doing something wrong, because just calling Cesium.Ellipsoid.WGS84.cartographicToCartesian(cartographicPosition) brings it back to the exact numbers I had before.

Am I misunderstanding the purpose of this function?

Alexander Wood

unread,
Jul 9, 2014, 7:18:33 PM7/9/14
to cesiu...@googlegroups.com

Hi Ryan,
The cartographic latitude and longitude values are in radians.

Alex

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Littlefield

unread,
Jul 9, 2014, 7:29:25 PM7/9/14
to cesiu...@googlegroups.com
Oh, now I just feel silly. Thanks a ton!
Reply all
Reply to author
Forward
0 new messages