TLE file to azimuth and elevation

Hi all. I’m new to Orekit and TLE files. Could you point me to where I could find how to extract and calculate azimuth and elevation from a reference point on Earth to a satellite using TLE file?

Hi @mpavelic

Welcome to the Orekit forum!

First, you have to initialize a TLE object knowing your TLE data. Here an example:

final String line1 = "1 37753U 11036A   12090.13205652 -.00000006  00000-0  00000+0 0  2272";
final String line2 = "2 37753  55.0032 176.5796 0004733  13.2285 346.8266  2.00565440  5153";
final TLE tle = new TLE(line1, line2);

Then, you can initialize a TLEPropagator using the previous TLE.

 final TLEPropagator propagator = TLEPropagator.selectExtrapolator(

Knowing the coordinates of the station, you can create a GeodeticPoint and then a TopocentricFrame to access azimuth and elevation of the satellite. After creating the topocentric frame, you can use the methods getElevation() and getAzimuth().

 final GeodeticPoint point = new GeodeticPoint(latitudeInRadians, longitudeInRadians, altitudeInMeters);
final OneAxisEllispoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                                                                          Constants.WGS84_EARTH_FLATTENING,
                                                                          FramesFactory.getITRF(IERSConventions.IERS_2010, true)))
 final TopocentricFrame topo = new TopocentricFrame(earth, point, "topo");

 // Satellite state at a desired epoch
 SpacecraftState state = propagator.propagate(desiredEpoch);
 // Compute azimuth and elevation
 final double azimuth = topo.getAzimuth(state.getPosition(), state.getFrame, state.getDate);
 final double elevation = topo.getElevation(state.getPosition(), state.getFrame, state.getDate);

You can find some other details in that post:

Best regards,
Bryan

1 Like

Hi @bcazabonne. Thank you very much for fast response. One question. As far as I can see there is not method which getPosition() in SpacecraftState which is used for determinig azimuth and elevation.

Oh sorry ! I have just written this code snippet in the forum editor. To access the position you have to use state.getPVCoordinates().getPosition() instead of state.getPosition().

Bryan

Hello
I am using an elevation detector to find passages over a ground station, then for each pass I calculate some intermediate points on the passage ground track, with elevation and azimuth.

The Problem is that the elevation and azimuth I get are wrong, the elevation is very often below zero, and the azimuth is not ok. I did the same using the Predict library and the points azimuth+elevation looks correct.
here is the code I use:

    // ISS
    String l1 = "1 25544U 98067A   22272.20280866  .00014743  00000+0  26227-3 0  9997";
    String l2 = "2 25544  51.6449 181.2521 0002650 316.9525 197.4867 15.50381701361312";

    double aoi_lat = 0;
    double aoi_lon = 0;
    double aoi_alt = 0;

    // make TLE
    TLE aOrkitTle = new TLE(l1, l2);

    // 
    FactoryManagedFrame ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            ITRF);

    // area of interest, lat lon point
    GeodeticPoint aoiPoint = new GeodeticPoint(FastMath.toRadians(aoi_lat), FastMath.toRadians(aoi_lon), aoi_alt);
    // to frame
    final TopocentricFrame aoiTopoFrame = new TopocentricFrame(earth, aoiPoint, "AOI");

    // tle propagator
    TLEPropagator propagator = TLEPropagator.selectExtrapolator(aOrkitTle);

    // now
    AbsoluteDate abd = new AbsoluteDate(2022, 9, 29, 10, 23, 0.0, TimeScalesFactory.getUTC());
  
    // get spacecraft state
    SpacecraftState spacecraftState = propagator.propagate(abd);
    // 
    PVCoordinates pvCoordinates = spacecraftState.getPVCoordinates(ITRF);
    //
    GeodeticPoint geodeticPoint = earth.transform(
            pvCoordinates.getPosition(),
            ITRF,
            abd);

    // lat lon of propagated point
    double latitude = FastMath.toDegrees(geodeticPoint.getLatitude());
    double longitude = FastMath.toDegrees(geodeticPoint.getLongitude());

    // azimuth and elevation of propagated point
    final double azimuth = FastMath.toDegrees(aoiTopoFrame.getAzimuth(pvCoordinates.getPosition(), spacecraftState.getFrame(), abd));
    final double elevation = FastMath.toDegrees(aoiTopoFrame.getElevation(pvCoordinates.getPosition(), spacecraftState.getFrame(), abd));

    System.out.println("Propagated at " + abd + ": lat=" + latitude + "; lon=" + longitude + "; azimuth=" + azimuth + "; elevation=" + elevation);

=> result:
Propagated at 2022-09-29T10:23:00.000Z: lat=-1.5944622459512572; lon=14.94036744327584; azimuth=266.9278983301713; elevation=-73.96827945877185

At this date the ISS is east of the AOI/observerpoint at lat:0 lon: 0, over congo. And the values shall be azimuth 96.1 and elevation 5.9

I cannot see what am I doing wrong…

Best regards

Gilles

I think you computed pvCooordinates in itrf frame but then passed them to getazimut stating they are in spacecraft state frame