跪拜 Guibai
← All articles
Frontend · Cesium

From TLE to Trajectory: Drawing the ISS Orbit in Cesium

By 亲亲小宝宝鸭 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Browser-based satellite tracking and visualization depends on this exact chain: parse TLE, propagate with SGP4/SDP4, then reconcile ECI with Cesium's Earth-fixed coordinates. The single-GMST rule is the difference between an orbit that looks right and one that visibly drifts or twists as the Earth spins.

Summary

Two 69-character TLE lines are enough to draw the International Space Station's orbit on a Cesium globe. satellite.js parses them with twoline2satrec into a SatRec structure, then propagate() runs SGP4 for near-Earth objects or SDP4 for deep-space orbits and returns ECI position vectors in kilometers. From there the caller handles the coordinate transform: eciToEcf() rotates the vector around Earth's Z axis by GMST, and Cesium.Cartesian3.fromElements() converts kilometers to meters for the ECEF frame Cesium expects.

The trajectory uses one GMST value for every sample point, so the orbit stays fixed in the inertial frame while the Earth rotates beneath it. Using each sample's own GMST would produce a ground-track line that drifts with Earth. A CallbackProperty recomputes both the ISS marker and the polyline before every frame, and a cached last-valid position prevents the satellite from snapping to Earth's center when propagation returns NaN or Infinity.

Takeaways
— A TLE consists of two fixed-width 69-character lines; twoline2satrec turns them into a SatRec object.
— satellite.js's propagate() returns ECI position in kilometers, not ECEF or geodetic coordinates.
— SGP4 handles near-Earth orbits like the ISS at 380 km; SDP4 handles deep-space orbits like GPS at about 20,200 km.
— ISS mean motion of roughly 0.0676 rad/min gives an orbital period of about 92.9 minutes.
— eciToEcf() rotates the ECI vector around the Z axis by GMST, which changes about 15 degrees per hour.
— For an inertial-frame orbit line, all sample points must share the same GMST; per-sample GMST yields an Earth-fixed ground track.
— Cesium's CallbackProperty recomputes positions each frame, so the orbit and satellite follow the simulation clock without manual updates.
— Propagation can return NaN or Infinity after orbital decay or outside model validity; caching the last valid position avoids a jump to Earth's center.
Conclusions

satellite.js deliberately stops at ECI and leaves ECEF conversion to the caller. That keeps the library frame-agnostic but pushes the hardest coordinate-frame decision into application code, where most orbit visualizations go wrong.

Using one GMST for the whole trajectory is a subtle but decisive choice: it draws the orbit in inertial space and lets Earth rotate underneath, which matches how a satellite's orbit is actually defined. Ground-track style visualization is a different product, not a bug.

The NaN/Infinity fallback is a reminder that TLE propagation is an approximation with an expiration date; production trackers need to handle model failure gracefully rather than assume propagate() always succeeds.

Concepts & terms
TLE (Two-Line Element set)
A fixed-width two-line text format that encodes a satellite's orbital state at an epoch: mean motion, inclination, eccentricity, right ascension of the ascending node, argument of perigee, mean anomaly, and drag coefficient. TLEs are the standard input for SGP4/SDP4 propagation.
SGP4/SDP4
Simplified perturbation models that propagate a satellite's position and velocity from a TLE. SGP4 handles near-Earth orbits; SDP4 extends it to deep-space orbits by adding resonance and lunar/solar effects.
ECI and ECEF
Earth-Centered Inertial is a fixed-in-space coordinate frame; Earth-Centered Earth-Fixed rotates with the planet. Satellite positions are first computed in ECI, then rotated into ECEF for rendering on a globe.
GMST (Greenwich Mean Sidereal Time)
The angle of Earth's rotation measured from the Greenwich meridian to the vernal equinox. It is the rotation angle used to convert ECI coordinates to ECEF, increasing roughly 15 degrees per hour.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗