Learn R Programming

geosphere (version 1.5-1)

bearing: Direction of travel

Description

Get the initial bearing (direction; azimuth) to go from point p1 to point p2 (in longitude/latitude) following the shortest path on an ellipsoid (geodetic) or a sphere (great circle). Note that the bearing of travel changes continuously while going along the path. A route with constant bearing is a rhumb line (see bearingRhumb).

Usage

bearing(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 one is longitude, second 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

Value

  • Bearing in degrees

References

http://williams.best.vwh.net/ftp/avsig/avform.txt http://www.movable-type.co.uk/scripts/latlong.html

See Also

bearingRhumb

Examples

Run this code
bearing(c(10,10),c(20,20))

Run the code above in your browser using DataLab