| dist_cpp | R Documentation |
Calculation of Euclidean or geographic distance. Based on an adaptation of
rdist.earth in the fields package.
Uses earth radius = 6378.388 km for great circle distance calculations.
dist_cpp(loc1, loc2, geographic)
loc1 |
A two column matrix representing the longitude/latitude (i.e. x/y) coordinates of the first set of distances. |
loc2 |
A two column matrix representing the longitude/latitude (i.e. x/y) coordinates of the second set of distances (for pairwise distance matrix set loc1 = loc2). |
geographic |
If TRUE, calculate great circle distance. If FALSE, calculate Euclidean distance. |
Note that while this function is still available to users. It is not
actively used in the intkrige function. Instead,
for user convenience, distances are calculated using distance
functions in the sp package.
A matrix of pairwise distances between each combination of rows from loc1 and loc2 respectively.
data(utsnow)
locs1 <- as.matrix(utsnow[, c("LONGITUDE", "LATITUDE")])
distMat <- dist_cpp(locs1, locs1, geographic = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.