How do I convert a mobile phone GPS to x,y,z with origin at the center of the Earth?

StackOverflow https://stackoverflow.com/questions/3398542

  •  09-10-2020
  •  | 
  •  

Question

I need to accurately visualize points coming from iPhone (and other) GPS data in 3D.

So, what I'd like is to take a WGS84 (right?) point and transform that into an X,Y,Z vector with the origin at the center of the Earth.

I Googled for GPS/WGS84 to 3D but I think my search terms are not so great

Does someone have a pointer for where to start?

In future, I'll also need to take elevation information into account if available, but that isn't so important immediately.

Thanks!

Was it helpful?

Solution

what your looking for is representing your data in ECEF (Earth Centered Earth Fixed) notation.

Some good wikipedia stuff

OTHER TIPS

Latitude and longitude are relatively easy, since they're just angles, however altitude is a bit tricky because the Earth isn't exactly round. If you don't need very great accuracy, this Wikipedia article has formulas for converting from a spherical coordinate system into a cartesian one. Be warned that this is not quite accurate because the Earth resembles an ellipsoid more than a perfect sphere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top