Method Deck / astronomy

Initial bearing between two points

Computes the initial compass bearing (forward azimuth) from one latitude/longitude point toward another along the great circle.

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. Convert both points' latitudes and longitudes to radians.
  2. theta = atan2( sin(dLon)*cos(lat2), cos(lat1)*sin(lat2) - sin(lat1)*cos(lat2)*cos(dLon) ), where dLon = lon2 - lon1.
  3. Convert theta to degrees and normalize into the range 0 to 360 by adding 360 and taking the result modulo 360.
  4. Round to 2 decimals.
  5. This is the initial bearing only; the bearing changes continuously along a great-circle route except along the equator or a meridian.

Constants

None.

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"lat1":0,"lon1":0,"lat2":0,"lon2":90}90.00 degrees
test vector: London to Paris{"lat1":51.5074,"lon1":-0.1278,"lat2":48.8566,"lon2":2.3522}148.12 degrees

Published card