The method is elaborated in IOGP Guidance Note 373-07-2, Oct 2018, Pg 100-104.
Let's assume the followings:
- G_phi, G_lam, G_eh be your Ground Station's lat, long, and ellipsoid height.
- P_phi, P_lam, P_eh be your Plane's lat, long, and ellipsoid height.
Next, let's compute the followings (from the Ground Station and Plane geodetic coordinates):
- Let gX, gY, gZ be the ECEF coordinates of your Ground Station.
- Let pX, pY, pZ be the ECEF coordinates of your Plane.
Your Ground Station's ENU coordinate is E=0, N=0, U=0. So there is nothing to compute. Your Plane's ENU coordinates, relative to your Ground Station, is therefore (using the scalar form of the formula):-
- E = (-1)(pX - gX)(sin G_lam) + (pY - gY)(cos G_lam)
- N = (-1)(pX - gX)(sin G_phi * cos G_lam) - (pY - gY)(sin G_phi * sin G_lam) + (pZ - gZ)(cos G_phi)
- U = (pX - gX)(cos G_phi * cos G_lam) + (pY - gY)(cos G_phi * sin G_lam) + (pZ - gZ)(sin G_phi)
(All geodetic coordinates are in radians.)(All geodetic coordinates are in radians.)
Reply to Comment
@rdb is dealing with altitudes (referring to some geoid)...
Questioner stated "GPS lat, lon, and altitude". Usually, this means ellipsoidal height. Moreover - Questioner used a plane as an example, hence unlikely the height is orthometric. =)
but turning polar to rectangular like a sphere, so it is not easy to write a correct answer.
Questioner was describing his approach which was unsuccessful. However, his/her description is not to be confused as his/her requirement to arrive at the correct answer.
Section 2.2.2 details the formulas discussed in your answer, to convert geocentric coordinates to topocentric ones, but first geographic coordinates must be converted into geocentric (section 2.2.1).
This is correct. My answer jumped directly into the ECEF coordinates (i.e., gX/gY/gZ and pX/pY/pZ), making the assumption that the Questioner knows how to convert phi/lambda/eh to ECEF XYZ. Moreover, Method 2.2.2 is chosen because it is easier to explain (and much less to type).