georange | R Documentation |
Calculate range of distances (min-max) between all points in one or two rectangular objects containing lon-lat coordinates.
georange(x, y, sequential = FALSE, measure = "cheap")
x |
Rectangular object (matrix, |
y |
Optional second object which, if passed, results in distances
calculated between each object in |
sequential |
If |
measure |
One of "haversine" "vincenty", "geodesic", or "cheap" specifying desired method of geodesic distance calculation; see Notes. |
A named vector of two numeric values: minimum and maximum, giving the respective distances in metres.
measure = "cheap"
denotes the mapbox cheap ruler
https://github.com/mapbox/cheap-ruler-cpp; measure = "geodesic"
denotes the very accurate geodesic methods given in Karney (2013)
"Algorithms for geodesics" J Geod 87:43-55, and as provided by the
'st_dist()' function from the sf package.
n <- 50
x <- cbind (-10 + 20 * runif (n), -10 + 20 * runif (n))
y <- cbind (-10 + 20 * runif (2 * n), -10 + 20 * runif (2 * n))
colnames (x) <- colnames (y) <- c ("x", "y")
# All of the following returns vector of two values: minimum and maximum:
d0 <- georange (x)
d1 <- georange (x, y)
d2 <- georange (x, sequential = TRUE)
d0_2 <- georange (x, measure = "geodesic") # nanometre-accurate version of d0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.