Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
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

(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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.