bearing | R Documentation |
Function bearing
calculates the bearing, in degrees, between two geographical locations.
Function bearingTrack
calculates the bearing between a sequence of locations.
bearing(lat1, lat2, lon1, lon2) bearingTrack(lat, lon)
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 |
Bearings are calculated using spherical trigonometry. Formulas are given in Zwillinger (2003).
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.
Carla Freitas
Zwillinger D. (2003) Standard Mathematical Tables and Formulae, 31st edition. Chapman & Hall/CRC, Boca Raton, FL.
distance
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.