r <- raster::raster(system.file('external/maungawhau.grd', package = 'gdistance'))
slope_cs <- create_slope_cs(r, cost_function = 'tobler')
loc1 = cbind(2667670, 6479000)
loc1 = sp::SpatialPoints(loc1)
loc2 = cbind(2667800, 6479400)
loc2 = sp::SpatialPoints(loc2)
lcps <- create_lcp(cost_surface = slope_cs, origin = loc1,
destination = loc2, directional = FALSE, cost_distance = FALSE)
Run the code above in your browser using DataLab