For the computation of the distance between 2 GPS points, it would be more precise to consider the WGS84 model to compute the local earth radius instead of considering the earth radius as a constant.
Here is a C coding of the function that computes the local earth radius as a function of the latitude (in radian).
One can take (local_earth_radius(lat1)+local_earth_radius(lat2))/2 as the earth radius in the method computeDistance().
double local_earth_radius(double lat_rad)
// WGS84 data
double a = 6378137.0;
double f = 1./298.257222101;
double e = sqrt(2.*f-f*f);
double R1, R2;
dum = 1. -e*e*sin(lat_rad)*sin(lat_rad);
R1 = a * (1. - e*e) / ( dum*sqrt(dum) );
R2 = a / sqrt(dum);
return( sqrt(R1*R2) );
Log in to post a comment.