Converting Geodetic Coordinates to Cartesian Coordinates and Back Again

Coordinates of Group Members' home places:              

Graham:  Portland, OR   -- 45.524ºN 122.675ºW     

Stephen: Philomath, OR  -- 44.540ºN 123.366ºW

Rachel:   St. Louis, MO  -- 38.627ºN  90.198ºW         

Peregrin: Honolulu, HI   --  21.307ºN 157.858ºW      

 

Equations to convert geodetic to cartesian coordinates:

X = (v+h) cos f cos l

Y = (v+h) cos f sin l

Z = {(1-e2)v+h} sin f

 where v = a/(1-e2sin2 f)0.5

            a = 6378137 m

          f = 1/298.25722563

          e2 = 2f-f2

          h = height above geoid (assumed to be 100 m)

          f = latitude (radians)

          l = longitude (radians)

 

Latitude Longitude a f e2 v v + h X Y Z Longitude [Arctan (X/Y)] (deg) Longitude + 180o E p b u (rad) Latitude (deg) h
Portland, OR 45.524 122.675 6378137 0.003353 0.006694 6389026 6389126 -2413526 3772067 4526612 -57.41629861 122.5837 0.006739 4478124 6356752 0.79246193 45.524 100
Philomath, OR 44.54 123.366 6378137 0.003353 0.006694 6388658 6388758 -2501261 3807305 4449339 -56.72529861 123.2747 0.006739 4555423 6356752 0.77529668 44.54 100
St. Louis, MO 38.627 90.198 6378137 0.003353 0.006694 6386465 6386565 -13263.7 4990698 3958417 -89.89329861 90.106701 0.006739 4990716 6356752 0.67218963 38.627 100
Honolulu, HI 21.307 157.858 6378137 0.003353 0.006694 6380955 6381055 -5503739 2248503 2302017 -22.23329861 157.7667 0.006739 5945327 6356752 0.37055376 21.307 100

To convert the cartesian coordinates back to geodetic coordinates, the following equations were used:

 l = [arctan (Y/X)] * 180o/3.14 (When this yielded a negative longitude, 180o were added to the angle)

f = arctan[ (Z + E*b (sin u)3)/(p - e2*a*(cos u)3)] * 180o/3.14

    where p = (X2 + Y2)0.5

                 u = arctan (Z*a/p*b)

             E = e2/(1-e2)

h = (X2 + Y2)0.5 1/(cos f) - v