Formula to Find Bearing or Heading angle between two points: Latitude Longitude

View akshay upadhyay's profile on LinkedIn

Formula to Find Bearing or Heading angle between two points. Bearing or heading is used to define navigation generally in the field of aircraft or marine or Vehicle navigation or while working for land surveying. So what’s the heading or bearing? How we can find bearing between the two points on earth, with the formula? Or How we can find the other point, when one point, actual traveled distance and bearing is given? Let us discuss all this points, followed with the example and experiment with the tool for calculating bearing provided in the post.

Formula to Find Bearing or Heading angle between two points: Latitude Longitude

Formula to Find Bearing or Heading angle between two points: Latitude Longitude

Bearing can be defined as direction or an angle, between the north-south line of earth or meridian and the line connecting the target and the reference point. While Heading is an angle or direction where you are currently navigating in.  This means to reach a particular destination you need to adjust your heading direction with the bearing. Generally a ‘compass’ is an instrument, which gives you the direction information for navigation. You must refer Haversine distance formula before going through this post.

Calculating Bearing or Heading angle between two points:

So if you are from GIS field or dealing with GIS application, you should know bearing and how to calculate bearing with formula. Let us look on formula and tool for bearing:

  • Let ‘R’ be the radius of Earth,
  • L’ be the longitude,
  • ‘θ’ be latitude,
  • β‘ be Bearing.

Denote point A and B as two different points, where ‘La’ is point A longitude and ‘θa’ is point A latitude, similarly assume for point B. Bearing would be measured from North direction i.e 0° bearing means North, 90° bearing is East, 180° bearing is measured to be South, and 270° to be West.

Note: If bearing is denoted with +ve or –ve initials whose values lies between 0° to 180°, then –ve is denoted for South and West sides.

Formula to find Bearing, when two different points latitude, longitude is given:

Bearing from point A to B, can be calculated as,

β = atan2(X,Y),

where, X and Y are two quantities and can be calculated as:

X = cos θb * sin ∆L

Y = cos θa * sin θb – sin θa * cos θb * cos ∆L

Lets us take an example to calculate bearing between the two different points with the formula:

  • Kansas City: 39.099912, -94.581213
  • St Louis: 38.627089, -90.200203

So X and Y can be calculated as,

X =  cos(38.627089) * sin(4.38101)

X  = 0.05967668696


Y = cos(39.099912) * sin(38.627089) – sin(39.099912) * cos(38.627089) * cos(4.38101)

Y = 0.77604737571 * 0.62424902378 – 0.6306746155 * 0.78122541965 * 0.99707812506

 Y = -0.00681261948

So as, β = atan2(X,Y) = atan2(0.05967668696, -0.00681261948)

           β = 96.51°

This means, from Kansas City if we move in 96.51° bearing direction, we will reach St Louis.

Tool to find bearing between two lat lon points:

latitude 1 :
longitude 1 :

latitude 2 :
longitude 2 :

Bearing =

Formula to find a lat lon point, when bearing, distance and another lat lon is given

Let us assume a condition, where you want to find out the where will an Airplane will land up, if you have following details of that Airplane, i.e actual distance it will travel, the bearing and the starting point (lat,lon)?

  • Let first point latitude be la1,
  • longitude as lo1,
  • d be distance,
  • R as radius of Earth,
  • Ad be the angular distance i.e d/R and
  • θ be the bearing,

Here is the formula to find the second point, when first point, bearing and distance is known:

  • latitude of second point = la2 =  asin(sin la1 * cos Ad  + cos la1 * sin Ad * cos θ), and
  • longitude  of second point = lo2 = lo1 + atan2(sin θ * sin Ad * cos la1 , cos Ad – sin la1 * sin la2)

You may find both the tool on separate page, with Google map working on it: (It will be update in 2 days, please visit us again)

  • Tool to Find Bearing, when two points are given
  • Tool to find other point, when bearing, distance and one of the point is given.

I hope this article will definitely help you, to find the bearing or heading. You are free to share more data related to bearing or any thing that you uses to calculate bearing and how you use navigation with bearing.

If you find anything difficulty to understand the bearing calculation, you may comment below, so that we will discuss further on finding bearing or heading angle.

10 thoughts on “Formula to Find Bearing or Heading angle between two points: Latitude Longitude

  1. Paul

    I trying to understand the derivation of X and Y.

    I understand how the bearing is given in Radians as β = atan2(X,Y)
    My understanding is that here X is the long difference and Y is the lat difference.

    What I don’t understand is why long diff isn’t just PointBLong – PointALong
    in other words,
    X = -90.200203 – ( -94.581213) = 4.38101
    Y = 38.627089 – 39.099912 = -0.472823

    then β = atan2( 4.38101, -0.472823)

    What am I missing?

    1. Thomas "Tim" Harris

      Long diff varies with how far from equator toward the pole you are, in other words varies with latitude. I think the X and Y are actually reversed in the above derivation. It works for me but only when I reverse them within the argument of the ATAN2 function. Maybe Akshay could comment on this, please. Also, in the Haversine distance formula referenced (linked) above, the delta lat and delta long formulas use point #1 minus point #2 instead of traditional delta values where the first value is subtracted from the second (i.e. point #2 minus point #1). The simple way to see these derivations is to understand that the polar coordinates of lat/long are first converted to cartesian (X, Y, Z) where the polar direction of lat/long is parallel to the cartesian Z direction, +X points to 0,0 lat/long and +Y points to 0, +90 lat/long. The cartesian are then the typical or common Earth-centered coords. A diagram of this will show why a Latitude-dependent coefficient or multiplier term must accompany Longitude, since the distance subtended at Earth’s surface by some fixed angle of longitude changes with the latitude where that distance is measured. At North or South poles, that distance will become zero as all longitudes collapse to the same point, the pole. Along the Equator, that distance will be its maximum as the lat-dependent coefficient equals unity.

  2. JH

    Here’s another method;

    Distance & Azimuth from Position to Destination

    Distance = 90 – Sin-1(sin(Destination Latitude) x sin(Your present Latitude) + cos(Destination Latitude) x cos(Your present Latitude) x cos(Difference in Longitude between Your Location and Destination Location)

    Multiply answer by 60 to get Nautical miles.

    Another way

    Distance = 60 x Cos-1(sin(Destination Latitude) x sin(Your present Latitude) + cos(Destination Latitude) x cos(Your present Latitude) x cos(Difference in Longitude between Your Location and Destination Location)

    Azimuth to Destination

    NOTE- LHA= Present Longitude – Destination Longitude

    Z = tan-1(sin (LHA) / (cos (LHA) x sin(Your present Latitude) – cos(Your present Latitude) x tan(Destination Latitude))

    Then to put Z into the right quadrant, apply the following rules-

    If answer is negative, add 180º to Z
    LHA is NEGATIVE if it’s less than 180º .

    Another way

    tan-1(sin(LHA) / (cos(Present Latitude) x tan(Destination Latitude) – (sin(Present Latitude) x cos(LHA))
    -continued on next page-
    If LHA is greater than 180 it’s treated as a negative quantity.
    If the Azimuth angle as calculated is negative, add 180 to it.

  3. ES

    The values that I got according to formulation for x and y are different!!
    X = cos(38.627089) * sin(4.38101) = -0.566840755 but not 0.05967668696
    Y = cos(39.099912) * sin(38.627089) – sin(39.099912) * cos(38.627089) * cos(4.38101) = 0.32763159818398435 not -0.00681261948

    1. Mario

      I had the same problem but I could figure out what was wrong. You have to convert your Lats and Longs to Radiant to get the correct results.
      Hopefully this helps.

  4. Archie

    thanks for the formula, but I have a question,
    the resulting bearing angle, we should use it from the geographical North right?
    not the magnetic north?

    thanks in advance

Comments are closed.

Subscribe For Latest GIS MAP Updates

Signup for our newsletter and get notified when we publish new articles for free!