I'm wondering about the transformation from Lat,Lon,Alt Values to 3D-Systems like ECEF (Earth-Centered).
This can be implemented as follows (https://gist.github.com/1536054):
/*
* WGS84 ellipsoid constants Radius
*/
private static final double a = 6378137;
/*
* eccentricity
*/
private static final double e = 8.1819190842622e-2;
private static final double asq = Math.pow(a, 2);
private static final double esq = Math.pow(e, 2);
void convert(latitude,longitude,altitude){
double lat = Math.toRadians(latitude);
double lon = Math.toRadians(longitude);
double alt = altitude;
double N = a / Math.sqrt(1 - esq * Math.pow(Math.sin(lat), 2));
x = (N + alt) * Math.cos(lat) * Math.cos(lon);
y = (N + alt) * Math.cos(lat) * Math.sin(lon);
z = ((1 - esq) * N + alt) * Math.sin(lat);
}
What in my opinion seems very strange is the fact, that a little change of the altitude, affects x,y and z, where I would expect, that it just affect one axis. For example, if I have two GPS-Points, which have same lat/lon values but different altitude values, I'll get 3 different x,y,z coordinates.
Can someone explain the "idea" behind this? This looks very curious to me... Is there any other 3D-System, in which only one of the values is changing, when I lower/higher my altitude value?
Thanks a lot!