View source: R/create_matrix.R
create_matrix | R Documentation |
This function creates a distance matrix between two spatial objects.
create_matrix(x, y, checksize = TRUE, longlat = FALSE)
x |
an sf object (POINT), rows of the distance matrix, row names are used as row names of the matrix. |
y |
an sf object (POINT), columns of the distance matrix, row names are used as column names of the matrix. |
checksize |
if FALSE, bypass the distance matrix size control (see Details). |
longlat |
if FALSE, the Euclidean distance is used, if TRUE Great Circle (WGS84 ellipsoid) distance is used. |
The function returns a full matrix of distances in meters. If the matrix to compute is too large (more than 100,000,000 cells, more than 10,000,000 origins or more than 10,000,000 destinations) the function may sends a message to warn users about the amount of RAM mobilized.
A distance matrix, row names are x
row names, column
names are y
row names.
g <- create_grid(x = n3_poly, res = 200000) mat <- create_matrix(x = n3_pt, y = g) mat[1:5, 1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.