Description Usage Arguments Details Author(s) Source Examples
The functions to calculate the spatial distance (meters) between a large number of longitude and latitude locations.
1 2 3 4 5 6 7 8 9 10 11 12 13 | deg2rad(deg)
gcd.slc(long1, lat1, long2, lat2)
gcd.hf(long1, lat1, long2, lat2)
gcd.vif(long1, lat1, long2, lat2)
gcd(long1.dg, lat1.dg, long2.dg, lat2.dg, distance = c("slc", "hf", "vif"))
geodesicDist.slc(lati.long.degrees, file = NA, sep = "\t")
geodesicDist.hf(lati.long.degrees, file = NA, sep = "\t")
|
deg |
The degrees. |
long1, lat1, long2, lat2 |
radian longitude or latitude of two points. |
long1.dg, lat1.dg, long2.dg, lat2.dg |
degrees longitude or latitude of two points. |
lati.long.degrees |
A 2-column data frame contains degrees latitude/longitude coordinates. The 1st col is latitude and 2nd is longitude. |
file |
Either a character string naming a file or a connection open for writing. "" indicates output to the console. If NA, as default, then do nothing. |
sep |
The field separator string. |
Converts degrees to radians
gcd.slc
calculates the geodesic distance (meters) between two points
specified by radian latitude/longitude using the spherical Law of Cosines (slc).
gcd.hf
calculates the geodesic distance (meters) between two points
specified by radian latitude/longitude using the Haversine formula (hf).
gcd.vif
calculates the geodesic distance (meters) between two points
specified by radian latitude/longitude using Vincenty inverse formula for ellipsoids (vif).
gcd.slc
calculates the geodesic distance (meters) between two points
specified by degrees latitude/longitude using Haversine formula (hf),
Spherical Law of Cosines (slc) and Vincenty inverse formula for ellipsoids (vif).
geodesicDist.slc
is a batch processing function to use gcd.slc
.
geodesicDist.hf
is a batch processing function to use gcd.hf
.
Mario Pineda-Krch
http://www.r-bloggers.com/great-circle-distance-calculations-in-r/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | lat1 <- deg2rad(deg)
long1 <- deg2rad(-36.8485)
lat1 <- deg2rad(174.7633)
long2 <- deg2rad(-37.7870)
lat2 <- deg2rad(175.2793)
# Auckland <=> Hamilton
dist.slc <- gcd.slc(long1, lat1, long2, lat2)
dist.hf <- gcd.hf(long1, lat1, long2, lat2)
dist.vif <- gcd.vif(long1, lat1, long2, lat2)
dist.vif <- gcd(-36.8485, 174.7633, -37.7870, 175.2793, distance="vif")
dists.btw <- geodesicDist.slc(env.byplot[, c("Latitude","Longitude")])
dists.btw <- geodesicDist.hf(env.byplot[, c("Latitude","Longitude")])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.