geod {tigers} | R Documentation |
Geodesic Distances
Description
This function calculates geodesic (or great-circle) distances between pairs of points with their longitudes and latitudes given in (decimal) degrees.
Usage
geod(lon, lat = NULL, R = 6371)
Arguments
lon |
either a vector of numeric values with the longitudes in
degrees, or, if |
lat |
a vector with the latitudes. |
R |
the mean radius of the Earth (see details). |
Details
The default value of R
is the mean radius of the Earth which is
slightly smaller than the radius at the equator (6378.1 km).
Value
a numeric symmetric matrix with the distances between pairs of points in kilometres.
Author(s)
Emmanuel Paradis
References
https://en.wikipedia.org/wiki/Great-circle_distance
https://en.wikipedia.org/wiki/Earth
https://en.wikipedia.org/wiki/Haversine_formula
See Also
Examples
## the distance between 0N 0E and 0N 180E...
geod(c(0, 180), c(0, 0)) # ~ 20015.09 km
## ... the same using the radius of the Earth at the equator:
geod(c(0, 180), c(0, 0), 6378.1) # ~ 20037.39 km
## The same comparison for two points 5 degrees apart:
geod(c(0, 5), c(0, 0)) # ~ 555.9746 km
geod(c(0, 5), c(0, 0), 6378.1) # ~ 556.5942 km
[Package tigers version 0.1-3 Index]