Monday, February 10, 2014

Geodetic coordinates and ECEF transformations

I ran into an interesting problem the other day: converting locations represented in latitude, longitude and altitude to an earth centered earth fixed coordinate system (and vice-versa). Now, there are umpteen resources (in print and out in the wild web) that present the formulae for doing this, but there was one particular result that was used as the basis of these that intrigued me. I wanted to know how that value was arrived at, but didn’t find any immediate obvious explanation of it on the web. So, I derived the relation for myself. Now, knowing how to get at that relation, I don’t ever need to remember the conversion formulae themselves, since I can always get at them (from a simple web search, or through first principles).

Let the LLA representation be denoted by a triplet (λ,ɸ,h), where λ,ɸ, h, denote the longitude, latitude, and height, respectively based on the geoid. Let (x,y,z) represent the corresponding coordinates in the ECEF frame. We wish to find the transformation:




The following figure shows the situation better

P is the point we want represented in both coordinate frames. P’P is the vector form the surface of the oblate geoid to the the actual point, with magnitude h. QP’ is normal vector through the surface of the geoid to point P. In the texts, magnitude of QP’ is N, and this is the subject of this page. Note the dashed ellipse representing the meridian ellipse. The meridian ellipse is defined as the locus of points with the same longitude (λ).

The coordinates are easy to derive, if N is given:


where 

a, is the semi major axis, e is the eccentricity of the ellipse. If b is the semi-minor axis, then a, b and e are related by:

Consider the meridian ellipse as shown below. The two cardinal directions in this ellipse are u,z, where the u-axis is along the projection of P on the equatorial plane.

To determine N, we must first determine the intercept, Q, on the z-axis. If we can find the slope to the line QP’, then we can determine the equation to the line QP’, which will allow us to determine Q, and consequently N. 

Since QP is normal to the ellipse (by definition), it must be perpendicular to the tangent at the point P’(phi,lamda,0). The slope of the tangent at any point on the ellipse maybe computed as the first derivative of the equation of the ellipse. which is given by:




i.e. 

Given a line with slope m, the slope of a line perpendicular to it is given by -1/m, i.e. the slope of line QP’, m’, is:

Consequently, equation of line QP’ is  whence, Q is given by setting u = 0, i.e. 




N can now be easily computed: 

Since 



Now, z0 can be computed as 


Therefore, projection of QP on z-axis is 








No comments: