distance_euclidean_pairwise | R Documentation |
Calculates distances between two vectors of geometries. There are a number of different distance methods that can be utilized.
distance_euclidean_pairwise(x, y)
distance_hausdorff_pairwise(x, y)
distance_vicenty_pairwise(x, y)
distance_geodesic_pairwise(x, y)
distance_haversine_pairwise(x, y)
distance_euclidean_matrix(x, y)
distance_hausdorff_matrix(x, y)
distance_vicenty_matrix(x, y)
distance_geodesic_matrix(x, y)
distance_haversine_matrix(x, y)
x |
and object of class |
y |
and object of class |
There are _pairwise()
and _matrix()
suffixed functions to
generate distances pairwise or as a dense matrix respectively.
The pairwise functions calculate distances between the ith element
of each vector. Whereas the matrix functions calculate the distance
between each and every geometry.
Euclidean distance should be used for planar geometries. Haversine, Geodesic, and Vicenty are all methods of calculating distance based on spherical geometries. There is no concept of spherical geometries in rsgeo, so choose your distance measure appropriately.
Hausdorff distance is calculated using Euclidean distance.
Haversine, Geodesic, and Vicenty distances only work with rs_POINT
geometries.
For _matrix
functions, returns a dense matrix of distances whereas _pairwise
functions return a numeric vector.
set.seed(1)
x <- geom_point(runif(5, -1, 1), runif(5, -1, 1))
y <- rev(x)
distance_euclidean_matrix(x, y)
distance_hausdorff_matrix(x, y)
distance_vicenty_matrix(x, y)
distance_geodesic_matrix(x, y)
distance_haversine_matrix(x, y)
distance_euclidean_pairwise(x, y)
distance_hausdorff_pairwise(x, y)
distance_vicenty_pairwise(x, y)
distance_geodesic_pairwise(x, y)
distance_haversine_pairwise(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.