Class TLEParser
java.lang.Object
gaiasky.util.coord.TLEParser
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Holds parsed orbital elements for a spacecraft. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractOrbitalElements
(List<String> lines, String name) Extracts the TLE orbital elements for a spacecraft with the given name.fetchTLEData
(String urlString) Downloads TLE data from the given URL.getOrbitalElements
(String url, String targetName) Fetches the TLE data from the given URL and extracts the orbital elements for the given target name.
-
Constructor Details
-
TLEParser
public TLEParser()
-
-
Method Details
-
getOrbitalElements
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
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
Extracts the TLE orbital elements for a spacecraft with the given name.- Parameters:
lines
- list of lines from a TLE filename
- the exact name of the spacecraft to search for (case-insensitive)- Returns:
- OrbitalElements object if found, otherwise null
-