Cesium orbit doesn't match STK

1. A concise explanation of the problem you're experiencing.
When I export an ephemeris from STK and load it into Cesium, the orbit shown by Cesium does not match the orbit shown by STK.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
let viewer = new Cesium.Viewer('cesiumContainer');
viewer.clock.currentTime = {dayNumber: 2458212, secondsOfDay: 42161};

let satellite = new Cesium.CzmlDataSource;
satellite.load('./czml/20580.czml');
viewer.dataSources.add(satellite);

Output from STK:
stk.v.11.0

# WrittenBy STK_v11.3.0

BEGIN Ephemeris

    NumberOfEphemerisPoints 1441

    ScenarioEpoch 3 Apr 2018 00:00:00.000000

# Epoch in JDate format: 2458211.50000000000000
# Epoch in YYDDD format: 18093.00000000000000

    InterpolationMethod Lagrange

    InterpolationSamplesM1 5

    CentralBody Earth

    CoordinateSystem Fixed

# Time of first point: 3 Apr 2018 00:00:00.000000000 UTCG = 2458211.50000000000000 JDate = 18093.00000000000000 YYDDD

    EphemerisTimePosVel

0.0000000000000000e+00 -4.5359764575516172e+06 -5.1607743254736066e+06 7.8450448190850485e+05 4.4020439857647179e+03 -4.4121431216952478e+03 -3.5181212882812092e+03
6.0000000000000000e+01 -4.2633659746787520e+06 -5.4153372021275945e+06 5.7186106703641638e+05 4.6821636433380363e+03 -4.0705953408420937e+03 -3.5673772905035821e+03
1.2000000000000000e+02 -3.9744597835689671e+06 -5.6489450263801431e+06 3.5672754495527950e+05 4.9450586788787823e+03 -3.7138731467569614e+03 -3.6010946415013723e+03
1.8000000000000000e+02 -3.6703219200022179e+06 -5.8607289135145778e+06 1.4004087407265083e+05 5.1897217377712914e+03 -3.3433716467381305e+03 -3.6191301790898519e+03
2.4000000000000000e+02 -3.3520748546701646e+06 -6.0499052372829933e+06 -7.7255459084215123e+04 5.4152129892680623e+03 -2.9605366807835630e+03 -3.6214095111198794e+03
3.0000000000000000e+02 -3.0208953299297499e+06 -6.2157784988459554e+06 -2.9421557524083735e+05 5.6206637958249121e+03 -2.5668589578200181e+03 -3.6079272817916039e+03
.
.
.
8.6100000000000000e+04 -3.0418970521981153e+06 -6.1834822848993465e+06 -6.0170556574387930e+05 5.6963104946808426e+03 -2.4615842324743921e+03 -3.5616261309548709e+03
8.6160000000000000e+04 -2.6944042479060069e+06 -6.3192270286859050e+06 -8.1394040601075685e+05 5.8831564064111089e+03 -2.0618722431855058e+03 -3.5102602605819197e+03
8.6220000000000000e+04 -2.3363547718379921e+06 -6.4307626048556063e+06 -1.0226341556490948e+06 6.0480842638911272e+03 -1.6548757212985529e+03 -3.4436332384725238e+03
8.6280000000000000e+04 -1.9690835373093646e+06 -6.5176988908674316e+06 -1.2268796827632689e+06 6.1904472213785630e+03 -1.2421630793468501e+03 -3.3620407645807518e+03
8.6340000000000000e+04 -1.5939617414616649e+06 -6.5797404361530812e+06 -1.4257895535368568e+06 6.3096830156480883e+03 -8.2532055586322872e+02 -3.2658435326732092e+03
8.6400000000000000e+04 -1.2123917257039957e+06 -6.6166873442836497e+06 -1.6184998816606605e+06 6.4053160631113433e+03 -4.0594596881778750e+02 -3.1554655083608768e+03

END Ephemeris

Input CZML:
[
  {"id": "document", "version": "1.0"},
  {
    "id": "Hst",
    "name": "Hst",
    "position": {
      "epoch": "2018-04-03T00:00:00",
      "cartesian": [
        0.0, -4535976.457551617, -5160774.325473607, 784504.4819085049,
        60.0, -4263365.974678752, -5415337.2021275945, 571861.0670364164,
        120.0, -3974459.783568967, -5648945.026380143, 356727.5449552795,
        180.0, -3670321.920002218, -5860728.913514578, 140040.87407265083,
        240.0, -3352074.8546701646, -6049905.237282993, -77255.45908421512,
        300.0, -3020895.32992975, -6215778.498845955, -294215.57524083735,
.
.
.
        86100.0, -3041897.0521981153, -6183482.2848993465, -601705.5657438793,
        86160.0, -2694404.247906007, -6319227.028685905, -813940.4060107569,
        86220.0, -2336354.771837992, -6430762.604855606, -1022634.1556490948,
        86280.0, -1969083.5373093646, -6517698.890867432, -1226879.682763269,
        86340.0, -1593961.741461665, -6579740.436153081, -1425789.5535368568,
        86400.0, -1212391.7257039957, -6616687.34428365, -1618499.8816606605],
      "referenceFrame": "Fixed"
    },
    "label": {"text": "Hst"},
    "point": {
      "color": {"rgba": [255, 0, 0, 255]},
      "pixelSize": 5.0,
      "outlineColor": {"rgba": [255, 255, 255, 255]},
      "outlineWidth": 2.0
    },
    "path": {
      "width": 1,
      "leadTime": 3000,
      "trailTime": 3000,
      "resolution": 120,
      "material": {"solidColor": {"color": {"rgba": [255, 0, 0, 255]}}}
    }
  }
]

I was not able to find how to include an attachment, otherwise I would have attached the output ephemeris and czml files.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

4. The Cesium version you're using, your operating system and browser.
Cesium 1.43.0
Both Centos7 w/Firefox and Windows10 with Chrome

I tested this out using STK 11.2.1 using the built-in CZML exporter and as far as I can tell the orbit matches visually. The default camera positions are slightly different between STK and Cesium but I attempted to match them up roughly by moving the camera by hand.

The only change I made in STK was to turn off the ground track display since that’s not exported.

STK: https://gist.githubusercontent.com/shunter/a952b57d29634dc8607b5dc59485cf9a/raw/5c87a5b9d575e77889b6bb9ac4c0a7477d9affe7/stk.png

Cesium: https://gist.githubusercontent.com/shunter/a952b57d29634dc8607b5dc59485cf9a/raw/5c87a5b9d575e77889b6bb9ac4c0a7477d9affe7/cesium.png

You can see the full exported CZML here:

https://gist.github.com/shunter/a952b57d29634dc8607b5dc59485cf9a

Without seeing your full code it’s hard to tell where your error might be.

Hi Scott,

Thanks for your quick response. I don’t have the built-in CZML exporter for STK, so I had to create the CZML myself. Here are my files showing the ephemeri; the .e file is theoutput from STK, the .czml file is what I read into Cesium. I created the czml file from the .e file, and the values match completely. I’ve also included two screenshots, one showing what STK displays and one showing what Cesium displays.

let satellite = new Cesium.CzmlDataSource;
satellite.load(’./czml/20580.czml’);
viewer.dataSources.add(satellite);

The code I used to create the Cesium view is:
let viewer = new Cesium.Viewer(‘cesiumContainer’);
viewer.clock.currentTime = {dayNumber: 2458212, secondsOfDay: 42161};

20580.czml (96.7 KB)

Hst_20580.e (231 KB)

The epoch in your CZML is specified in local time, not UTC.

“epoch”: “2018-04-03T00:00:00”,

Add Z at the end.

Yes, that fixed it. Thank you.