Re: GPS formulas
- From: Tauno Voipio <tauno.voipio@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 29 May 2005 09:01:16 GMT
Richard Sloan wrote:
I have been looking for formulas to help me create a special GPS device, I need to know distance from current position to a point (LAT,LONG) and also I need a function to let me know when I am passing by a point and if its to the left, right, ahead, or behind me, and it would be nice to know by how much.
Below are formula I found on the web and thought would be at least part of my answer, these were referred to as great circle equations.
I am not a math wiz, I am very good at math, but not to the point I could come up with these equations myself :-)
Can anyone help with whats required?
Thanks! Richard.
Now for the distance I have used successfully:
dLAT = LAT1 - LAT2;
dLONG = LONG1 - LONG2;
R = 6731000.0
double dist2(void) {
return R*2*asin(sqrt((sin((dLAT)/2))*(sin((dLAT)/2)) + cos(LAT1)*cos(LAT2)*(sin((dLONG)/2))*(sin((dLONG)/2))));
}
And for nearing I have used rather unsuccessfully:
double bearing(void) {
C = fmod(atan2(sin(dLONG)*cos(LAT2),cos(LAT1)*sin(LAT2)-sin(LAT1)*cos(LAT2)*cos(dLONG)), 2*PI);
C = ((C*180)/PI)
return C; }
The great circle formulae get increasingly inaccurate when you get near the waypoint. This is because the great circle distance is calculated as the sine or cosine of the route seen from Earth's center (6400 kilometers / 4000 miles away). The accuracy of the trigonometric functions will play a significant role in short distances.
The shortest route (great circle route) will have a changing heading (direction) unless the route is north-south or along the equator. There is a little longer route with a constant heading called the rhumbline.
One reference is <http://williams.best.vwh.net/avform.htm>. There are plenty of others, Google for 'great circle navigation'.
HTH
--
Tauno Voipio, CPL(A), aeronautic navigation instructor tauno voipio (at) iki fi
.
- References:
- GPS formulas
- From: Richard Sloan
- GPS formulas
- Prev by Date: Re: Looking for Embeeded kernel to load onto ARM Micro-controller (128K Flash, 64K RAM)
- Next by Date: Re: CCD / CMOS affordable camera kits???
- Previous by thread: Re: GPS formulas
- Next by thread: Re: GPS formulas
- Index(es):
Relevant Pages
|