# NOT RUN {
r <- raster::raster(system.file('external/maungawhau.grd', package = 'gdistance'))
loc1 = cbind(2667670, 6479000)
loc1 = sp::SpatialPoints(loc1)
loc1 <- rgeos::gBuffer(spgeom = loc1, width = 200)
raster::crs(loc1) <- raster::crs(r)
slope_cs <- create_slope_cs(r, cost_function = 'tobler', neighbours = 16, max_slope = NULL)
slope_cs_cropped <- crop_cs(cost_surface = slope_cs, boundary = loc1)
# }
Run the code above in your browser using DataLab