finalDirection function

Final direction

Final direction

Get the final direction (bearing) when arriving at p2 after starting from p1 and following the shortest path on an ellipsoid (following a geodetic) or on a sphere (following a great circle). 1.1

finalBearing(p1, p2, a=6378137, f=1/298.257223563, sphere=FALSE)

Arguments

  • p1: longitude/latitude of point(s). Can be a vector of two numbers, a matrix of 2 columns (first column is longitude, second column is latitude) or a SpatialPoints* object
  • p2: as above
  • a: major (equatorial) radius of the ellipsoid. The default value is for WGS84
  • f: ellipsoid flattening. The default value is for WGS84
  • sphere: logical. If TRUE, the bearing is computed for a sphere, instead of for an ellipsoid

Returns

A vector of directions (bearings) in degrees

Examples

bearing(c(10,10),c(20,20)) finalBearing(c(10,10),c(20,20))

Author(s)

This function calls GeographicLib code by C.F.F. Karney

References

C.F.F. Karney, 2013. Algorithms for geodesics, J. Geodesy 87: 43-55. tools:::Rd_expr_doi("10.1007/s00190-012-0578-z") . Addenda: https://geographiclib.sourceforge.io/geod-addenda.html. Also see https://geographiclib.sourceforge.io/

See Also

bearing

  • Maintainer: Robert J. Hijmans
  • License: GPL (>= 3)
  • Last published: 2024-10-04

Useful links