Map Latitud, Longitud and altitud, help

Hello,
How can I get latitud, longitud and altitud to draw to a map?
I get the data (latitud, longitud and distance) for stations (topocentric) to satellite, by propagation, based on the example from Orekit in Python transcripted to Java.
Now, I would like to draw to a map satellite position but regarding to global position. Obviously, those data can’t be localized to the station.
How could I use the .getelEvation(), .getAzimuth() methods…? Could it be creating a topocentric point from Earth o something similar? (Surely not)
Could I use the variable:?

Vector3D pos_tmp = pv.getPosition();

Thank you

Hi @omarlopez

Let baseFrame be your TopocentricFrame (i.e. the same you used to call the methods getElevation(), getAzimuth(), etc.). You can easily compute the geodetic coordinates of the spacecraft by doing this:

 final BodyShape bodyShape = baseFrame.getParentShape();
 final GeodeticPoint satelliteAsGeodeticPoint = bodyShape.transform(Vector3D point, Frame frame, AbsoluteDate date);

Where Vector3D point is the satellite position (i.e. pv.getPosition()), Frame frame is the frame in which the position is expressed (i.e. state.getFrame()), and AbsoluteDate date is the computation date (i.e. state.getDate()).

Finally, you can access the geodetic coordinates of the spacecraft by calling satelliteAsGeodeticPoint.getLatitude(), satelliteAsGeodeticPoint.getLongitude() and satelliteAsGeodeticPoint.getAltitude(). Please note that angles are in radians and altitude in meters.

Best regards,
Bryan

Hello @bcazabonne. Thank you for answering so fast.
I tried with the code you gave me with geostationary satellite but it does’nt return correct data. I’m doing something wrong with the frame.
I give you the code I use. From begining to “OK”, I think it’s working well. From there is the code to positionate satellite on a map (regardless of the station).
Could you help me with that?
Thank you.

package pruebaorekit_1;

import java.io.File;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.orekit.bodies.BodyShape;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.data.DataProvidersManager;
import org.orekit.data.DirectoryCrawler;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.TopocentricFrame;
import org.orekit.propagation.analytical.tle.TLE;
import org.orekit.propagation.analytical.tle.TLEPropagator;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.TimeStampedPVCoordinates;

/**
*

  • @author Omar
    */
    public class PruebaOrekit_1_2 {

    public static void main(String[] args) {

//INIT OREKIT
File orekitData = new File(“orekit-data”);
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new DirectoryCrawler(orekitData));
//////////////////////////////

    /*

HISPASAT 30W-6
1 43228U 18023A 20321.69312970 -.00000216 00000-0 00000-0 0 9998
2 43228 0.0484 49.5242 0001716 179.9066 46.3688 1.00271182 10037
*/
String TLE_1 = “1 43228U 18023A 20321.69312970 -.00000216 00000-0 00000-0 0 9998”;
String TLE_2 = “2 43228 0.0484 49.5242 0001716 179.9066 46.3688 1.00271182 10037”;

    TLE TLE_HISPASAT = new TLE(TLE_1, TLE_2);

    Frame ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, true);

    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING, ITRF);

    //Station
    double longitude = (0.10472); //6
    double latitude = (0.0174533);//1
    double altitude = 903.0;

    GeodeticPoint station = new GeodeticPoint(latitude, longitude, altitude);
    TopocentricFrame station_frame = new TopocentricFrame(earth, station, "Esrange");

    Frame inertialFrame = FramesFactory.getEME2000();

    TLEPropagator propagator = TLEPropagator.selectExtrapolator(TLE_HISPASAT);

    AbsoluteDate extrapDate = new AbsoluteDate(2020, 11, 18, 15, 0, 0.0, TimeScalesFactory.getUTC());

    AbsoluteDate finalDate = extrapDate.shiftedBy(120);

    while (extrapDate.compareTo(finalDate) <= 0.0) {
        TimeStampedPVCoordinates pv = propagator.getPVCoordinates(extrapDate, inertialFrame);

        Vector3D pos_tmp = pv.getPosition();

        double elevation = (station_frame.getElevation(pv.getPosition(), inertialFrame, extrapDate) * 180.0d) / Math.PI;

        double azimuth = (station_frame.getAzimuth(pv.getPosition(), inertialFrame, extrapDate) * 180.0d) / Math.PI;

        double distance = station_frame.getRange(pv.getPosition(), inertialFrame, extrapDate) / 1000;

        System.out.println("Antenna orientation");
        System.out.println("Time: " + extrapDate);

        System.out.println("elevation: " + elevation);

        System.out.println("Acimuth: " + azimuth);

        System.out.println("Distance: " + distance);

        System.out.println("*****");

//------------------------OK--------------------------
///Map position ----NEW CODE
BodyShape bodyShape = station_frame.getParentShape();

        //I think that the problem is bodyShape.getBodyFrame()¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
        GeodeticPoint satelliteAsGeodeticPoint = bodyShape.transform(pos_tmp, bodyShape.getBodyFrame(), extrapDate);

        double lat = ((satelliteAsGeodeticPoint.getLatitude()) * 180.0d) / Math.PI;
        double lon = ((satelliteAsGeodeticPoint.getLongitude()) * 180.0d) / Math.PI;
        double alt = satelliteAsGeodeticPoint.getAltitude()/1000;

        System.out.println("Global map");
        System.out.println("lat: " + lat);
        System.out.println("lon: " + lon);
        System.out.println("alt " + alt);
        System.out.println("---------------------------------------");

        extrapDate = extrapDate.shiftedBy(10.0);
    }
}

}

You should use inertialFrame instead of bodyShape.getBodyFrame() when calling the method bodyShape.transform(...)

Indeed the frame to use is the frame in which the satellite’s position is expressed and not the body frame.

Bryan

Thank you very much @bcazabonne !!!
It’s working well now.