Cartesian Coordinates to Geo Position

156 Views Asked by At

Having $(lat, lon)$ I used the following formulae to convert it to Cartesian \begin{align} x & = R \cos(lat) \cos(lon)\\ y &= R \cos(lat) \sin(lon) \end{align}

Now, I need to convert x,y back to latitude, longitude.

I need the solution for the inversion formulae

1

There are 1 best solutions below

0
On BEST ANSWER

You can get the longitude by taking $\arctan \frac yx$ and correcting for the quadrant. If you have Atan2 available it will take care of the quadrant. Then you can find the $\cos$ and $\sin$ of that and divide them out. Now you just need an $\arccos$ to get there.