Learn R Programming

argosfilter (version 0.70)

bearing: Bearing between geographical locations

Description

Function bearing calculates the bearing, in degrees, between two geographical locations. Function bearingTrack calculates the bearing between a sequence of locations.

Usage

bearing(lat1, lat2, lon1, lon2)
bearingTrack(lat, lon)

Value

bearing returns the bearing, in degrees, between the first location and the second location. 0 is North. bearingTrack returns a vector of bearings between the sequence of locations.

Arguments

lat1

latitude of the first location, in decimal degrees

lat2

latitude of the second location, in decimal degrees

lon1

longitude of the first location, in decimal degrees

lon2

longitude of the second location, in decimal degrees

lat

vector of latitudes, in decimal degrees

lon

vector of longitudes, in decimal degrees

Author

Carla Freitas

Details

Bearings are calculated using spherical trigonometry. Formulas are given in Zwillinger (2003).

References

Zwillinger D. (2003) Standard Mathematical Tables and Formulae, 31st edition. Chapman & Hall/CRC, Boca Raton, FL.

See Also

distance

Examples

Run this code
# Bearing between two geographical locations:
lat1<-rnorm(1,80)
lat2<-rnorm(1,80)
lon1<-rnorm(1,20)
lon2<-rnorm(1,20)
bearing(lat1,lat2,lon1,lon2)

# Bearing between a sequence of 10 geographical locations:
lat<-rnorm(10,80)
lon<-rnorm(10,20)
bearingTrack(lat,lon)

Run the code above in your browser using DataLab