gisgeospatialspatialspatial-data

What is initial bearing and final bearing


I am trying to calculate bearing between two lat/lon points as given in this link. I see that the bearing we get initially using the below equation is initial bearing.

    public static double GetBearing(double latitude1, double longitude1, double latitude2, double longitude2)
        {
            var lat1 = ToRadians(latitude1);
            var lat2 = ToRadians(latitude2);
            var longdiff = ToRadians(longitude1 - longitude2);
            var X = Math.Cos(lat2) * Math.Sin(longdiff);
            var Y = Math.Cos(lat1) * Math.Sin(lat2) - Math.Sin(lat1) * Math.Cos(lat2) * Math.Cos(longdiff);
            var bearing =ToDegrees(Math.Atan2(X, Y));
            return (bearing+360)%360;
        }

It is given that

For final bearing, simply take the initial bearing from the end point to the start point and reverse it (using θ = (θ+180) % 360).

I am confused about the difference between initial bearing and final bearing. What is this initial and final bearing and which bearing should we take as the final answer for bearing between two points.


Solution

  • The bearing is the angle between direction along the shortest path to destination and direction to North. The reason we have initial and final one is that we live on sphere, so the shortest path is geodesic line. It is a straight line on globe, bit if you draw it on flat map - it will be a curve.

    There are two ways to think about it. Thinking on flat map: as you travel from A to B, this curve changes direction slightly, so the angle between this line and North changes, i.e. bearing changes.

    Or you can think on sphere, and then think about triangle A - B - North Pole. The bearing is angle between between AB and appropriate meridian. Initial bearing is angle between AB and meridian crossing A. Final one is angle between AB and meridian crossing B. They are different.

    The single "final answer" bearing only makes sense when distance between A and B is short. Then the curvature of Earth does not matter much, and the initial and final bearings are very close to each other, so depending on precision needed one can talk about single bearing.