AER to ECI transformation

I’m new to Orekit and all things space related really. I have been asked to convert some Python code that uses pymap3d to transform AER to ECI, among other things.

The Python code looks simple enough:

eci = pymap3d.aer2eci(aer[0],aer[1],aer[2],lla[0],lla[1],lla[2],datetime_obj,deg=True)

aer = (47.12870363270617, 0.060779582235353284, 97797.74919860299)
lla = (15.21934054186741, 72.21482879258566, 11421241.506469073)
eci = (9272659.053536154, 14445262.180521432, 4704213.693840145)

Is there an Orekit equivalent to the aer2eci pymap3d method?

Thank you.


If you want to compute the position vector from a ground location and a time-stamped azimuth+elevation+range measurement, please look here.
The only prerequisite is to create a TopocentricFrame attached to the longitude+latitude+altitude information, represented in Orekit by GeodeticPoint.
Note that the class TrackingCoordinates is only available in version 12.0, but you don’t have to use it to perform these calculations, it’s just a data container.


Please see the last comment.

    public static void main(String[] args) {
        // Orekit setup data
        File orekitData = new File("/Users/gormanst/orekit-data");
        DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
        manager.addProvider(new DirectoryCrawler(orekitData));
        // Define the Earth ellipsoid (WGS84 in this case)
        OneAxisEllipsoid earth = new OneAxisEllipsoid(
                FramesFactory.getITRF(IERSConventions.IERS_2010, true)
        // Define the date for the transformation
        var unix_timestamp = 1695854094;
        Instant instant = Instant.ofEpochSecond((long) unix_timestamp);
        ZonedDateTime utcDateTime = ZonedDateTime.ofInstant(instant, ZoneId.of("UTC"));
        AbsoluteDate date = new AbsoluteDate(utcDateTime.getYear(),
        // Observer position on Earth
        GeodeticPoint observer = new GeodeticPoint(38.1400000152 , -78.449999981,  190.9961962523);
        // Create a topo-centric frame centered at the observer's location
        TopocentricFrame topocentricFrame = new TopocentricFrame(earth, observer, "Observer");
        How do I utilize my AER values to get something like:
        topocentricPosition = something(azimuth, elevation, range);

        so I can execute the below code?
        Vector3D eciPosition = topocentricFrame.getTransformTo(eciFrame, date).transformPosition(topocentricPosition)

With a little help from chatGPT I cobbled together a complete example that might be what I need? Attached is my complete example code but the main functionality comes from this method.

 private static PVCoordinates aerToECI(AbsoluteDate date, double observerLatitude, double observerLongitude,
                                          double observerAltitude, double azimuth, double elevation, double range) {
        // Define the Earth ellipsoid (WGS84 in this case)
        OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));

        // Create a TopocentricFrame for the observer location
        GeodeticPoint observerLocation = new GeodeticPoint(observerLatitude, observerLongitude, observerAltitude);
        TopocentricFrame topocentricFrame = new TopocentricFrame(earth, observerLocation, "ObserverTopocentricFrame");

        // Transform AER to ECI coordinates
        PVCoordinates pvECI = topocentricFrame.getTransformTo(earth.getBodyFrame(), date)
                .transformPVCoordinates(new PVCoordinates(new Vector3D(range * Math.cos(elevation) * Math.sin(azimuth),
                        range * Math.cos(elevation) * Math.cos(azimuth), range * Math.sin(elevation)),
                        new Vector3D(0, 0, 0)));  // Velocity is assumed to be zero in this example

        return pvECI;

Is this even close? It seems like the post you reference, but way more verbose. (4.0 KB)

I think it’s correct, kuddos to the generative AI (which is probably relying on this very forum).
Hopefully your code snippet will help others.


1 Like