Learn R Programming

spNetwork (version 0.4.3)

closest_points: Find closest points

Description

Solve the nearest neighbour problem for two feature collections of points This is a simple wrap-up of the dbscan::kNN function

Usage

closest_points(origins, targets)

Arguments

origins

a feature collection of points

targets

a feature collection of points

Value

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

Examples

Run this code
# NOT RUN {
#This is an internal function, no example provided
eventsgpkg <- system.file("extdata", "events.gpkg", package = "spNetwork", mustWork = TRUE)
mtl_libraries <- sf::st_read(eventsgpkg,layer="mtl_libraries")
mtl_theatres <- sf::st_read(eventsgpkg,layer="mtl_theatres")
close_libs <- closest_points(mtl_theatres, mtl_libraries)
# }

Run the code above in your browser using DataLab