How to project satellite orbit onto Earth from existing satellite objects?

Hi guys.

My team and I are trying to implement a function that will take our current satellite orbits and project the image onto the Earth's surface. However, our current attempt only displays wavy lines somewhere near Africa.

Our current implementation is as follows:

drawGroundTrack : function(viewer, dataSourceObject)
{
    var pos = ;

    var satPositions = dataSourceObject.position.cartesian;

    var latLongPos = null;

    for (var i = 1; i < satPositions.length; i += 4)
    {
        latLongPos = Cesium.Ellipsoid.WGS84.cartesianToCartographic(new Cesium.Cartesian3(satPositions[i], satPositions[i + 1], satPositions[i + 2]));

        pos.push(Cesium.Cartesian3.fromDegrees(latLongPos.longitude, latLongPos.latitude));

        latLongPos = null;
     }

     viewer.entities.add({

         polyline : {
    positions : pos,
    width : 1.0,
    material : new Cesium.PolylineGlowMaterialProperty({
                     color : Cesium.Color.DEEPSKYBLUE,
         glowPower : 0.25
    })
   }

    });
}

The data for satellites are generated on a backend server and the positions are sent via CZML. A sample of the data:

"position":{
    "interpolationAlgorithm":"LAGRANGE",
    "interpolationDegree":5,
    "referenceFrame":"INERTIAL",
    "epoch":"2015-08-01T12:40:20Z",
    "cartesian":[
      0,11819242.705263585,7972431.135792671,4811666.251546643,
      300,10731415.381943967,8072935.194237854,3253712.8462225525,
      600,9497296.045803875,8062819.782944127,1652163.8659633754,
      ...

We also tried using EllipsoidGeodesic but with no luck. Could you guys please give us some advice on how to solve this problem?

Thanks. :slight_smile:

I think you just have a radians vs. degrees error. In the for loop, try replacing Cesium.Cartesian3.fromDegrees with Cesium.Cartesian3.fromRadians.

-Hannah

Thank you so much! Damn, I feel rather foolish for missing that haha. It now renders across the globe.

The only issue I have now is that the orbits and the lines on the Earth do not match, even though it is from the same data. Do I need to set an original position?