2
$\begingroup$

Given are two geo locations, each with latitude and longitude.

One is the current location, the other is a target location.

is there a formula for calculating the target's cardinal direction for 0 being North, 90 being East and so on?

Edit: Needed is the direction for the shortest distance. It isn't necessary to give a solution for two opposite locations (for example the poles).

  • 0
    Given two antipodal points, say on the equator, how are you going to decide in a consistent manner what the direction is from one to the other? What about if the current location is one of the poles?2011-06-14
  • 0
    Good point, added it to the question.2011-06-14
  • 1
    Do you want the direction along [the shortest path to the target](http://en.wikipedia.org/wiki/Great_circle) or along [the line of constant heading](http://en.wikipedia.org/wiki/Rhumb_line)?2011-06-14
  • 0
    The reason I bring this up is because getting directions out of great circles can be counterintuitive: the direction from London to Anchorage, Alaska is north, for example, and so is the direction from Anchorage to London.2011-06-14

2 Answers 2