# Geodetic to geocentric coordinates - strange behaviour

Hello everyone,

I am trying to convert geodetic coordinates (latitude, longitude, altitude) to geocentric, in order to obtain parallax constants.
Here is the MPC site that is providing them, I am using it as a test set :
https://minorplanetcenter.net/iau/lists/ObsCodesF.html
How to calculate them:
https://www.projectpluto.com/mpc_stat.htm (last paragraph)
"
The parallax constants ρsin(φ’) and ρcos(φ’) provide cylindrical coordinates: ρcos(φ’) tells you how far the observatory is from the earth’s axis, and ρsin(φ’) tells you how far above or below the earth’s plane it is, both in units of the earth’s equatorial radius, 6378.140 km.
"

Using Orekit, I have came with following code:

``````            Frame earthFrame = null;
try {
earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
} catch (OrekitException e) {
logger.error(e);
throw new OcException(e);
}

// Earth ellipsoid
ReferenceEllipsoid ellipsoid = ReferenceEllipsoid.getWgs84(earthFrame);
// point on earth ellipsoid, observatory position
GeodeticPoint point = new GeodeticPoint(lat, lon, alt);
// observatory position on Earth's surface in ITRF frame
Vector3D position = ellipsoid.transform(point);
``````

The point is, that “position” vector is not like I expected.
For Lat | Lon | Height : 33.818100, -106.659200, 1516
it gives me : {-4,664,290.387576218; -728,573.0950706318; 4,276,717.292840527}

When I use online converter: https://www.ngs.noaa.gov/NCAT/
The results are as follows :
X -1,521,046.869
Y -5,083,061.199
Z 3,530,536.457

Results from this site matches Observation Codes specified on MPC site.

I am using observatory 704 as example:
704 253.34093 0.831869 +0.553542 Lincoln Laboratory ETS, New Mexico

Simple calculations give:
sqrt(1,521,046.869^2+5,083,061.199^2) = 5305760.52329
5305760.52329 / 6378137 = 0.83186681679 <-- this is the “cos” value from MPC

Could anyone explain me why Orekit’s transform is giving me strange results?
What is the correct way to do this?

I would be glad for any help provided.
Regards,

Hi,

Did you convert degrees to radians? (I often forget.)

Otherwise can you provide a small complete example that shows the issue? As a JUnit test case would be ideal.

Best Regards,
Evan

1 Like

Hello,

You were right about angles conversion !
This pair of latitude + longitude is provided so often (and ingested by programs too) in degrees, that I was not thinking about the coversion to radians.

I blame late Friday’s mood

Thank you very much for help .

The answer: GeodeticPoint shall be constructed from Lat, Lon in radians, and altitude in meters.