closest_points: Find closest points

Description Usage Arguments Value Examples

View source: R/spatial_indexing.R

Description

Solve the nearest neighbour problem for two SpatialPointsDataFrame. This is a simple wrap-up of the FNN::knnx.index function

Usage

1
closest_points(origins, targets)

Arguments

origins

a SpatialPointsDataFrame

targets

a SpatialPointsDataFrame

Value

for each origin point, the index of the nearest target point

Examples

1
2
3
4
5
#This is an internal function, no example provided
eventsgpkg <- system.file("extdata", "events.gpkg", package = "spNetwork", mustWork = TRUE)
mtl_libraries <- rgdal::readOGR(eventsgpkg,layer="mtl_libraries", verbose=FALSE)
mtl_theatres <- rgdal::readOGR(eventsgpkg,layer="mtl_theatres", verbose=FALSE)
close_libs <- closest_points(mtl_theatres, mtl_libraries)

spNetwork documentation built on Oct. 30, 2021, 5:06 p.m.