dist_cpp {intkrige} | R Documentation |
Distance matrix calculation.
Description
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.
Usage
dist_cpp(loc1, loc2, geographic)
Arguments
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. |
Details
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.
Value
A matrix of pairwise distances between each combination of rows from loc1 and loc2 respectively.
Examples
data(utsnow)
locs1 <- as.matrix(utsnow[, c("LONGITUDE", "LATITUDE")])
distMat <- dist_cpp(locs1, locs1, geographic = TRUE)