Compute the bearing between two geographic points.
- Note
- Derived from https://gist.github.com/jeromer/2005586
N.B. In PostGIS, for geodetic coordinates, X is longitude and Y is latitude The formulae used is the following: lat = sin(Δlong).cos(lat2) long = cos(lat1).sin(lat2) - sin(lat1).cos(lat2).cos(Δlong) θ = atan2(lat, long)