gcd.slc | R Documentation |
Calculates the geodesic distance between two points (or multiple pairs of points) specified by radian latitude/longitude.
gcd.slc(long1, lat1, long2, lat2)
long1 |
longitude(s) in radians, vector of one or more numbers |
lat1 |
latitude(s) in radians, vector of one or more numbers |
long2 |
longitude(s) in radians, vector of one or more numbers |
lat2 |
latitude(s) in radians, vector of one or more numbers |
long1 and lat1 must be same length. long2 and lat1 must be same length.
All four must be the same length, defining pairs of points.
Alternatively long1 and lat1 can define a single point while long2 and lat2 define a series of points, or vice versa.
Taken from http://www.r-bloggers.com/great-circle-distance-calculations-in-r/
but use pmin
instead of min
to vectorize it to handle at least pairs.
Distance in kilometers
convert
, gcd
, get.distances
, get.distances.all
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.