View source: R/great_circle_distance.R
gcd | R Documentation |
Calculates the geodesic distance between two points specified by radian latitude/longitude using one of the Spherical Law of Cosines (slc), the Haversine formula (hf), or the Vincenty inverse formula for ellipsoids (vif).
gcd(p1, p2, type = "hf", na = 0)
p1 |
Location of point 1 with (lat, long) coordinates. |
p2 |
Location of point 2 with (lat, long) coordinates. |
type |
Specific algorithm to use, c('slc', 'hf', 'vif'). |
Distance in kilometers (km).
http://www.r-bloggers.com/great-circle-distance-calculations-in-r/
# Point in (lat, long) format p1 <- c(30.0, 120.0) p2 <- c(30.5, 120.5) gcd(p1, p2) gcd(p1, p2, type="hf") gcd(p1, p2, type="vif")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.