# How to calculate a heading on the earths surface?

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?

-
Adding a little more detail to your question would be nice. Not knowing a lot about the field, I had no idea what WGS-84 was, so I would have to look it up: en.wikipedia.org/wiki/… – Larry Wang Jul 26 '10 at 14:32
Is it correct to say that your question is: Given an initial position and a subsequent position, each given by latitude and longitude in the WGS-84 system, determine the heading in degrees clockwise from true north of movement? – Isaac Jul 26 '10 at 21:23
@Isaac Exactly. I changed the phrasing of the question yours is clearer. – Alexander Stolz Jul 27 '10 at 8:13

## 1 Answer

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)

-
Pretty much clears up every question about the topic. :) – Vortico Jul 27 '10 at 21:00