bug in geodetic2Enu
Opened this issue · 1 comments
Hi,
As mentioned in #30 and #28 the conversion between geodetic and ENU produce some error.
I did the following test:
since the reference longitude and latitude is the same as the longitude and latitude the expected ENU coordinate should be (0,0,100), but the code result in 0.237m error in y direction
after I change the line 55
ecef_to_ned_matrix_ = nRe(phiP, initial_longitude_);
to
ecef_to_ned_matrix_ = nRe(initial_latitude_, initial_longitude_);
the code works well:
and my question is the conversion between geodesic and ENU should be an invertable function why the original code compute the geocentric latitude "phiP" to compute the ecef_to_ned_matrix_ but use geodetic latitude "initial_latitude_" to compute the ned_to_ecef_matrix_ ? Did I missed something important?
Miller
Reading https://en.wikipedia.org/wiki/Geographic_coordinate_conversion at "From ECEF to ENU" they mention that
Note:
ϕ is the geodetic latitude. A prior version of this page showed use of the geocentric latitude ϕ′ . The geocentric latitude is not the appropriate up direction for the local tangent plane. If the original geodetic latitude is available it should be used, otherwise, the relationship between geodetic and geocentric latitude has an altitude dependency
It looks like this code is constructing the R_ecef_to_enu/R_ecef_to_end matrix using geocentric latitude (phiP) where it should be using the geodetic latitude.