distance
estimates the distance given a starting &
ending latitude and longitude. For general
information on Vincenty's formula, see e.g.,
http://en.wikipedia.org/wiki/Vincenty's_formulae. It
states: Vincenty's formulae are two related
iterative methods used in geodesy to calculate the distance
between two points on the surface of an spheroid, developed
by Thaddeus Vincenty in 1975. They are based on the
assumption that the figure of the Earth is an oblate
spheroid, and hence are more accurate than methods such as
great-circle distance which assume a spherical Earth.
Note: this method assumes a locations are lat &
lon given in WGS 84. Direction, if requested, is the
the initial bearing (sometimes referred to as forward
azimuth) for which one would follow as a straight line
along a great-circle arc from start to finish.
Note: this will fail if there are NA's in the data.
distance(lat1, lon1 = NULL, lat2 = NULL, lon2 = NULL, bearing = FALSE)
destination
#get the distance of 1 degree longitude at each 5 degrees latitude from -90 to 90
distance(lat1=seq(-90,90,5),lon1=rep(0,37),lat2=seq(-90,90,5),lon2=rep(1,37),bearing=TRUE)
Run the code above in your browser using DataLab