powered by
Add nearest neighbor information by osrm route service
assign_nn(x, y, y.id = "id", k = 10, crs = 32721)
sf object of source distance criteria or data.frame with "x" and "y" coordinates
sf object of destination distance criteria or data.frame with "x" and "y" coordinates
name of y variable for identification. Default "id"
numeric value for the near neighbor linear criteria, to reduce the computation for nearest neighbor by route
Coordinate Reference Systems (CRS), used only if x or y are not sf . Default = "32721").
x object with three new variables
y.id of nearest neighbor
time by car to nearest neighbor in minutes
distance by route to nearest neighbor in kilometers
# NOT RUN { pop_epp_nn <- assign_nn(x = pop_epp[1:20,], y = centers_epp) # }
Run the code above in your browser using DataLab