# How do I determine a direction?

I have three points on a map: origin, position, and destination. For each point, I have a latitude and longitude. The position point includes the lat/long plus a heading. The heading is in degrees between $0^{\circ}$ and $360^{\circ}$. $0^{\circ}$ and $360^{\circ}$ both represent absolute North.

I want to draw an arrow that points from towards the destination from the current position, considering the heading. How do I determine the degree to draw the line from and two.

Essentially, I'm trying to figure out how to build a compass where the destination is always north.

-
That probably depends on whether you want the arrow to point along the shortest path to the destination or along the line of constant heading. – Rahul Feb 5 '11 at 19:43

## 1 Answer

(Too long for a comment) How do you want to use the heading information? Rahul has given two reasonable choices for a path from the current position to the destination, but neither needs heading information. Think of the corresponding problem in the plane-you just put a ruler between the current position and the destination and the direction is whatever it is, not some prespecified heading.

The last sentence seems unrelated to the question above. To know north you don't need a destination, but it seems you are thinking of using the north pole. It is true that if the destination is the north pole the direction to take is north, but that doesn't tell you how to find north looking at the ground. You need some outside information, such as the magnetic field, position of the sun, or GPS signals to do that.

-