Given an initial position and a subsequent position, each given by latitude and longitude in the WGS-84 system. How do you determine the heading in degrees clockwise from true north of movement?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
First, some background. A "line" (the object containing the path of least distance between two points) on a sphere is a great circle; a great circle is the intersection of a sphere with a plane passing through the center of the sphere. A spherical triangle is the triangle formed by the spherical line segments connecting three non-collinear points on a sphere. Below is the Spherical Law of Cosines as it appears in UCSMP Functions, Statistics, and Trigonometry, 3rd ed., copied here because the diagram is good and helps with clarity.
If ABC is a spherical triangle with arcs a, b, and c (meaning the measures of the arcs, not the lengths), then cos c = cos a * cos b + sin a * sin b * cos C.
Now, to the specific problem at hand. Let's use the diagram below, also from UCSMP Functions, Statistics, and Trigonometry, 3rd ed., for reference.
Let B be the initial point and A be the final point of the movement (and for simplicity, I'll assume they are both in the northern hemisphere, and leave extending the solution to any points as an exercise); N and S are the north and south poles, respectively; C and D are the points on the equator that are on the same line of longitude as A and B, respectively. Consider spherical triangle ABN. a = (90° - latitude of point A); b = (90° - latitude of point B). N = positive difference in longitude between points A and B. Use the Spherical Law of Cosines (cos n = ... form) to determine n, then use the Spherical Law of Cosines (cos b = ... form) to determine B. If the points are arranged as pictured, the heading of travel from B to A is 360° - B; for other arrangements of the points, the exact method of determining the heading based on the measure of angle B may vary.
(graphics from Lesson 5-10 of UCSMP Functions, Statistics, and Trigonometry, 3rd ed., © 2010 Wright Group/McGraw Hill)