Examples for 'stplanr::route_nearest_point'


Find nearest route to a given point

Aliases: route_nearest_point

Keywords:

### ** Examples

r <- routes_fast_sf[2:6, NULL]
p <- sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(r))
Error in .subset2(x, i, exact = exact): attempt to select less than one element in get1index
route_nearest_point(r, p, id_out = TRUE)
Error in .subset2(x, i, exact = exact): attempt to select less than one element in get1index
r_nearest <- route_nearest_point(r, p)
Error in .subset2(x, i, exact = exact): attempt to select less than one element in get1index
plot(r$geometry)
Warning in min(x): no non-missing arguments to min; returning Inf
Warning in max(x): no non-missing arguments to max; returning -Inf
Warning in min(x): no non-missing arguments to min; returning Inf
Warning in max(x): no non-missing arguments to max; returning -Inf
plot of chunk example-stplanr-route_nearest_point-1
Error in plot.window(...): need finite 'xlim' values
plot(p, add = TRUE)
Error in plot(p, add = TRUE): object 'p' not found
plot(r_nearest, lwd = 5, add = TRUE)
Error in plot(r_nearest, lwd = 5, add = TRUE): object 'r_nearest' not found

[Package stplanr version 1.2.2 Index]