distance {argosfilter} | R Documentation |
Great circle distance between geographical coordinates
Description
Function distance
calculates the distance, in km, between two geographical locations
following the great circle route.
Function distanceTrack
calculates the distance, in km, between a sequence of locations.
Usage
distance(lat1, lat2, lon1, lon2)
distanceTrack(lat,lon)
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 |
Details
Distances are calculated using spherical trigonometry. See details on formulae in Zwillinger (2003).
Value
distance
returns the distance between the two locations.
distanceTrack
returns a vector of distances between the sequence of locations.
In both cases, distances are given in km.
Author(s)
Carla Freitas
References
Zwillinger D. (2003) Standard Mathematical Tables and Formulae, 31st edition. Chapman & Hall/CRC, Boca Raton, FL.
See Also
Examples
# Distance between two geographical locations
lat1<-rnorm(1,80)
lon1<-rnorm(1,20)
lat2<-rnorm(1,80)
lon2<-rnorm(1,20)
distance(lat1,lat2,lon1,lon2)
# Distance between a sequence of 10 geographical locations:
lat<-rnorm(10,80)
lon<-rnorm(10,20)
distanceTrack(lat,lon)