checks that locations can be reached when calculating least-cost paths
check_locations(x, locations)
message
conductanceMatrix
sf
'POINT' or 'MULTIPOINT', SpatVector
, data.frame
or matrix
containing the locations coordinates
Joseph Lewis
Using the supplied conductanceMatrix and locations, the function checks whether: (1) the supplied locations are traversable from at least one adjacent cell (2) the supplied locations are within the extent of the supplied conductanceMatrix
r <- terra::rast(system.file("extdata/SICILY_1000m.tif", package="leastcostpath"))
slope_cs <- create_slope_cs(x = r, cost_function = "tobler")
locs <- sf::st_sf(geometry = sf::st_sfc(
sf::st_point(c(861534, 4173726)),
sf::st_point(c(897360, 4155813)),
sf::st_point(c(928364, 4138588)),
crs = terra::crs(r)))
check_locations(x = slope_cs, locations = locs)
Run the code above in your browser using DataLab