Class TLEParser

java.lang.Object
gaiasky.util.coord.TLEParser

public class TLEParser extends Object
A utility to fetch and parse TLE (Two-Line Element) orbital data for a given spacecraft from a remote URL and extract its orbital elements and epoch.
  • Constructor Details

    • TLEParser

      public TLEParser()
  • Method Details

    • getOrbitalElements

      public TLEParser.OrbitalElements getOrbitalElements(String url, String targetName) throws Exception
      Fetches the TLE data from the given URL and extracts the orbital elements for the given target name.
      Parameters:
      url - The URL to fetch the data.
      targetName - The name of the target object.
      Returns:
      The TLEParser.OrbitalElements instance with the parsed data.
      Throws:
      Exception - If the fetching or parsing fails.
    • fetchTLEData

      public List<String> fetchTLEData(String urlString) throws IOException
      Downloads TLE data from the given URL.

      This method implements file-level caching, where TLE data files are cached per group. If a file for the given group (retrieved as a URL parameter) exists, the method checks whether the file modification date is older than the cache timeout (CACHE_TIMEOUT_MS). If it is, the file is pulled again from the remote server. Otherwise, the local file is used.

      Parameters:
      urlString - The URL to fetch TLE data from.
      Returns:
      A list of non-empty lines from the TLE file.
      Throws:
      IOException - If a network or read error occurs.
    • extractOrbitalElements

      public TLEParser.OrbitalElements extractOrbitalElements(List<String> lines, String name)
      Extracts the TLE orbital elements for a spacecraft with the given name.
      Parameters:
      lines - list of lines from a TLE file
      name - the exact name of the spacecraft to search for (case-insensitive)
      Returns:
      OrbitalElements object if found, otherwise null