Please Note I am using viewer.scene.pickPosition as I need to draw on the terrain and I am NOT using viewer.camera.pickEllipsoid

I am using the following code

 var earthPosition = viewer.scene.pickPosition(event.position);

the earthPosition object is as follows

Cartesian3 :{
x: -2356447.208926279
y: -3743919.310632037
z: 4582152.746595793
clone: ƒ (result)

After converting the above using below

var cartographic = Cesium.Cartographic.fromCartesian(cartesian3);

the output lat long are not correct.

I want to know is this "Cartesian3" a standard GIS EPSG co-ordinate system or its cesium projection system ?


The Cartesian3 is a three-dimensional coordinate in the Earth-Centered Earth-Fixed (ECEF) coordinate frame, which is Cesium's default internal frame for rendering in 3D. The origin (0, 0, 0) is at the center of the planet, the +X axis points towards the equator at longitude zero, The +Y axis points toward the equator at longitude 90, and +Z points towards the North Pole. The units are meters.

Cesium has a number of helper functions to convert to and from various other systems. The Picking Demo shows one example of this conversion happening:

    var cartesian = viewer.scene.pickPosition( ... );
    if (cartesian) {
        var cartographic = Cesium.Cartographic.fromCartesian(cartesian);

The docs for fromCartesian explain that this is using the WGS84 ellipsoid (by default) to convert to a Cartographic value containing longitude, latitude, altitude, the units for which are radians, radians, meters.

  • 1
    My original answer here said "Earth-Centered Fixed (ECF)". ECEF is likely a more descriptive and possibly more industry-standard term. The term I used (ECF) is the one historically used by the developers of the software (both STK and Cesium), and often appears in AGI documentation and blog posts. I'm fine with the answer showing ECEF, as long as folks know that's the same as ECF that shows up in the docs. – emackey Sep 16 '19 at 13:50
  • 1
    examples that are given can convert the viewer.camera.pickEllipsoid or viewer.camera.pickEllipsoid while i am using viewer.scene.pickPosition because I have terrain data so how to use viewer.scene.pickPosition data and convert it into Cartographic I tried your method but its giving wrong lat long – Abhijit Gujar Dec 4 '19 at 13:49
  • 1
    What kind of wrong? It's giving you Radians, so if you expect Degrees you'll need to convert it. – emackey Dec 4 '19 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.