Re: GPS formulas



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

.



Relevant Pages

  • Re: Firmware bugs on 76CSx (and probably on all C*x models): No Great Circle routes!
    ... rhumb lines are easy to plot on a flat chart. ... Create a route between two points on ... A rhumb line will be Course 90 degrees, distance 2250 Nautical Miles ... Great Circle will have an initial course of 56 degrees and be 2126 NM. ...
    (sci.geo.satellite-nav)
  • Horizon Problem Resolution (2/28/09)
    ... Inflation theory has been offered as a way to overcome this `Horizon Problem'. ... The inner circle of radius $r$ represents space at an earlier time. ... The cosmological redshift, $z$, is ... \section{Velocity Redshift and Distance Redshift Relations} ...
    (sci.physics.particle)
  • Horizon Problem Resolution (2/28/09)
    ... Inflation theory has been offered as a way to overcome this `Horizon Problem'. ... The inner circle of radius $r$ represents space at an earlier time. ... The cosmological redshift, $z$, is ... \section{Velocity Redshift and Distance Redshift Relations} ...
    (sci.physics)
  • Horizon Problem Resolution (2/28/09)
    ... Inflation theory has been offered as a way to overcome this `Horizon Problem'. ... The inner circle of radius $r$ represents space at an earlier time. ... The cosmological redshift, $z$, is ... \section{Velocity Redshift and Distance Redshift Relations} ...
    (sci.astro)
  • Re: 31 miles behind wheel?
    ... It could have been a radius of such & such a distance from the centre of the town, with just as many grey areas. ... If the law restricts the drivers to certain sections of that route then that is enough, ... If I go shopping from where I live to Hanley, it costs a pound each way on the bus, which runs every 10 minutes. ...
    (uk.transport.buses)