Description Usage Arguments Value Author(s) Source References See Also Examples
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.
1 |
lat1 |
a single value or vector of values representing latitude in decimal degrees from -90 to 90 degrees. Alternatively, a data.frame or matrix can be used here with each column representing lat1, lon1, lat2, lon2 (in that order). |
lon1 |
a single value or vector of values representing longitude in decimal degrees from -180 to 180 degrees. If NULL, lat1 is assumed to be a matrix or data.frame. |
lat2 |
a single value or vector of values representing latitude in decimal degrees from -90 to 90 degrees. If NULL, lat1 is assumed to be a matrix or data.frame. |
lon2 |
a single value or vector of values representing longitude in decimal degrees from -180 to 180 degrees. If NULL, lat1 is assumed to be a matrix or data.frame. |
bearing |
boolean value as to calculate the direction as well as the distance. |
Returns a data.frame with:
lon1 |
the original longitude |
lat1 |
the original latitude |
lon2 |
the destination longitude |
lat2 |
the destination latitude |
distance |
the distance used |
bearing |
if requested, the bearing between the two points |
Jeremy VanDerWal jjvanderwal@gmail.com
The source code for the distance algorithm here was
modified from
http://www.movable-type.co.uk/scripts/latlong-vincenty.html.
Distances were validated against Geoscience Australia
calculations
(http://www.ga.gov.au/geodesy/datums/vincenty_inverse.jsp).
Bearings were from multiple sources including
http://williams.best.vwh.net/avform.htm#Crs.
Vincenty, T. 1975. Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of Nested Equations. Survey Review, vol XXII no 176. http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
1 2 |
lat1 lon1 lat2 lon2 distance bearing
1 -90 0 -90 1 0.00 90.50000
2 -85 0 -85 1 9734.15 90.49810
3 -80 0 -80 1 19391.28 90.49240
4 -75 0 -75 1 28895.14 90.48296
5 -70 0 -70 1 38171.07 90.46985
6 -65 0 -65 1 47146.67 90.45316
7 -60 0 -60 1 55752.52 90.43302
8 -55 0 -55 1 63922.76 90.40958
9 -50 0 -50 1 71595.61 90.38303
10 -45 0 -45 1 78713.83 90.35356
11 -40 0 -40 1 85225.05 90.32140
12 -35 0 -35 1 91082.08 90.28679
13 -30 0 -30 1 96243.05 90.25000
14 -25 0 -25 1 100671.60 90.21131
15 -20 0 -20 1 104336.93 90.17101
16 -15 0 -15 1 107213.84 90.12941
17 -10 0 -10 1 109282.75 90.08683
18 -5 0 -5 1 110529.68 90.04358
19 0 0 0 1 110946.26 90.00000
20 5 0 5 1 110529.68 89.95642
21 10 0 10 1 109282.75 89.91317
22 15 0 15 1 107213.84 89.87059
23 20 0 20 1 104336.93 89.82899
24 25 0 25 1 100671.60 89.78869
25 30 0 30 1 96243.05 89.75000
26 35 0 35 1 91082.08 89.71321
27 40 0 40 1 85225.05 89.67860
28 45 0 45 1 78713.83 89.64644
29 50 0 50 1 71595.61 89.61697
30 55 0 55 1 63922.76 89.59042
31 60 0 60 1 55752.52 89.56698
32 65 0 65 1 47146.67 89.54684
33 70 0 70 1 38171.07 89.53015
34 75 0 75 1 28895.14 89.51704
35 80 0 80 1 19391.28 89.50760
36 85 0 85 1 9734.15 89.50190
37 90 0 90 1 0.00 89.50000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.