Converting ECEF to LLH and back

One often has to convert between the X-Y-Z coordinate values of the ECEF system and the ellipsoidal values of Lat and Long (and height above the reference ellipsoid) system.  You can easily find source code to do this on the web.  But often you just need a quick conversion.  Watch the units you need to use! Units for ECEF will always be in meters, while for LLH the format styles of DD.dddd and DDMMSS.sss are both common.

There are many web-based tools to convert between Earth-Centered, Earth-Fixed (ECEF) coordinates and WGS84 Lat- Long- Height  (LLH) coordinates.  Here are two favorites we recommend:

The definitive and authoritative web source,
producing results which are accurate to mm is:

This in turn has a separate page for each conversion direction:

Latitude/Longitude/Height -> XYZ  and   XYZ -> Latitude/Longitude/Height

Here is an example of actual use. Running an ~8 hour set of observations into the Canadian NRCan CSRS-PPP service produced these results.  The estimated coordinates ITRF08 2016-03-20 for the SCSC_160320_12_8hr.obs RINEX file are as follows:

Latitude N34° 07′ 39.7671″ ±0.002m (95%)
Longitude W117° 49′ 31.6523″ ±0.006m (95%)
Ellipsoidal Height 250.640m ±0.009m (95%)
UTM Zone 11 (North)
Northing 3776624.330m
Easting 423883.941m
Scale factor (point) 0.99967142
Scale factor (combined) 0.99963209
Cartesian coordinates
X -2467178.313 ±0.006m (95%)
Y -4674384.341 ±0.007m (95%)
Z 3558322.813 ±0.005m (95%)
Orbits and Clocks Used: NRCan Hourly
WGS84 ellipsoid used for (x,y,z) to (lat,long,h) transformation

The key lines above are:

LLH   =  34.12771308,  -117.82545897,  250.640  in DDMMSS.sss form
ECEF = -2467178.313,  -4674384.341,   3558322.813 in M.mmm form

We want to compare the LLH and the XYZ values with these tools to confirm that the same results are obtained.  [In this case we mean the results between the two coordinate expressions, not the positional estimate itself]


Using this tool, and entering the XYZ values produced the following screen image.


One can see a precise match, with some additional precision provided by the NGS output.
The reverse translation produces the original value set.

US Navy Post Graduate Tool

Another easy to use page which leads in the search engines is here, but the accuracy is not sufficient for centimeter level work, and the fact that they want input in kilometers is (IMHO) a bit annoying.  On the plus side, the output is presented in a more useful format of deg and decimal degrees, not the DDMMSS.sss form used above.  Here is a screen image of the same conversion values with this tool.


One can see some decimeter rounding effects to the extent that you cannot be 100% sure.

Useful tools for GNSS in general:

I would be remiss if I did not mention two key sources for some other tools of this type

We stand on the shoulders of giants and think little of it.  Many thanks to Ben Remodi and his coworkers for so many of these tools.

And also take a look at:

Converting between NAD and WGS or other datums in North America?

Here is the link the link you were looking for

Was this article helpful?

Related Articles