
Identify geometries that are near to each other. Either get the index of all geometries within a cetain distance, or get the k nearest neighbors.
# S4 method for SpatVector
near(x, distance=0, k=1, centroids=TRUE, symmetrical=TRUE)
SpatVector
numeric. maximum distance
postive integer. number of neighbors. Ignored of distance > 0
logical. Should the centroids of polygons be used?
logical. If TRUE
, a near pair is only included once. That is, if geometry 1 is near to geometry 3, the implied nearness between 3 and 1 is not reported
matrix
# NOT RUN {
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
near(v, distance=12000)
# }
Run the code above in your browser using DataLab