Converting to and from TLE

Orbit Mean-Elements Messages whose mean elements follow the SGP4 theory can be converted into a classic Two-Line Element set (TLE), and TLEs can be converted into Orbit Mean-Elements Messages. This is useful to interoperate with the many tools in the SatelliteToolbox.jl ecosystem that consume TLEs, such as the SGP4 propagator, and to distribute TLEs in the CCSDS formats.

This capability is provided by a package extension that is loaded automatically once SatelliteToolboxTle.jl (version 2 or newer) is available in your environment:

julia> using Pkg

julia> Pkg.add("SatelliteToolboxTle")

Converting an OMM to a TLE

Load both packages and use Julia's convert function with the target type TLE. Assuming the variable omm holds an OrbitMeanElementsMessage for the Amazonia 1 satellite:

julia> using SatelliteToolboxTle
julia> tle = convert(TLE, omm)TLE: AMAZONIA 1 (Epoch = 2025-12-30T18:12:04.534): ├─ Line 1 │ Satellite Number : 47699 │ Classification : U │ International Designator : 21015A │ Epoch Year : 25 │ Epoch Day : 364.75838581 │ ṅ/2 : 4.47e-6 rev/day² │ n̈/6 : 0.0 rev/day³ │ B* : 0.0001533 1/ER │ Ephemeris Type : 0 │ Element Set Number : 999 └─ Line 2 Inclination : 98.3721° RA of the Ascending Node : 75.0877° Eccentricity : 0.0001124 Arg. of Perigee : 97.3772° Mean Anomaly : 262.7545° Mean Motion : 14.40772474 rev/day Revolution Number : 25439

The conversion maps the OMM fields to their TLE counterparts, including the translation of the OBJECT_ID (e.g. 2021-015A) into the TLE international designator format (e.g. 21015A).

Requirements and Behavior

  • Mean element theory. The conversion only succeeds when the metadata field mean_element_theory is equal to "SGP4". Otherwise, an error is raised, since the elements cannot be interpreted as a TLE.

  • Mean motion. TLEs are expressed in terms of the mean motion. If the OMM provides mean_motion directly, it is used as is. If only the semi_major_axis is available, the mean motion is computed from it, which additionally requires the gravitational parameter GM to be present:

    \[n = \frac{1}{2\pi}\sqrt{\frac{GM}{a^3}} \times 86400\]

  • Required TLE fields. Conversion requires classification_type, norad_cat_id, element_set_number, rev_at_epoch, bstar, mean_motion_dot, and mean_motion_ddot. Missing fields raise an error; they do not receive placeholder values. The optional ephemeris_type is copied when present and defaults to 0 otherwise.

  • Unsupported alternatives. OMM TLE parameters may represent drag with either bstar or bterm, and the second derivative slot with either mean_motion_ddot or agom. A classic TLE conversion requires bstar and mean_motion_ddot; conversion rejects bterm and agom because they have no direct TLE representation.

  • Epoch. The two-digit TLE year can only represent the years from 1957 to 2056, so an epoch outside this interval raises an error. The day fraction keeps the sub-millisecond precision of the message epoch.

Warning

The CCSDS standard does not fully specify whether the derivative fields (MEAN_MOTION_DOT and MEAN_MOTION_DDOT) already incorporate the SGP4 scaling factors. Based on the data returned by Celestrak and Space-Track, this package assumes they are already adjusted and copies them directly into the TLE.

Converting a TLE to an OMM

The opposite direction is provided by the constructor OrbitMeanElementsMessage(tle; kwargs...), which accepts any keyword of the keyword constructor OrbitMeanElementsMessage(; kwargs...) (see Creating OMMs) to override the generated fields. Julia's convert can also be used, in which case the message receives the default header:

julia> omm_from_tle = OrbitMeanElementsMessage(tle; originator = "MY AGENCY")OrbitMeanElementsMessage:
  ├─ Header
  │    Creation Date : 2026-09-09T00:00:38
  │    Originator    : MY AGENCY
  ├─ Metadata
  │    Object Name         : AMAZONIA 1
  │    Object ID           : 2021-015A
  │    Center Name         : EARTH
  │    Ref. Frame          : TEME
  │    Time System         : UTC
  │    Mean Element Theory : SGP4
  └─ Data
       ├─ Mean Keplerian Elements
       │    Epoch              : 2025-12-30T18:12:04.533984
       │    Mean Motion        : 14.40772474 rev/day
       │    Eccentricity       : 0.0001124
       │    Inclination        : 98.3721°
       │    RA of Asc. Node    : 75.0877°
       │    Arg. of Pericenter : 97.3772°
       │    Mean Anomaly       : 262.7545°
       └─ TLE Related Parameters
            Ephemeris Type      : 0
            Classification Type : U
            NORAD Cat ID        : 47699
            Element Set Number  : 999
            Rev at Epoch        : 25439
            B*                  : 0.0001533 1/ER
            ∂(Mean Motion)/∂t   : 4.47e-6 rev/day²
            ∂²(Mean Motion)/∂t² : 0.0 rev/day³
julia> convert(OrbitMeanElementsMessage, tle) isa OrbitMeanElementsMessagetrue

The mean Keplerian elements and the TLE-related parameters are copied from the TLE, and the metadata describes the conventions of the TLE format: the center name is "EARTH", the reference frame is "TEME", the time system is "UTC", and the mean element theory is "SGP4". The international designator (e.g. 21015A) is translated back to the OBJECT_ID format (e.g. 2021-015A); a designator that does not follow the TLE format is copied as is.

The TLE has no header information, so the message receives the current UTC time as creation_date and this package as originator, which are the fields most likely to be overridden with the keywords. The header classification and the message_id are left unset.

Note

The two-digit years of the TLE epoch and of the international designator are interpreted as in the SGP4 reference implementation: years from 57 to 99 refer to the 20th century, and years from 0 to 56 to the 21st century. The epoch is rounded to the microsecond, which is far below the resolution of the TLE epoch field (0.864 ms) and matches the precision of the messages distributed by Celestrak and Space-Track.