crop_cs: Crop conductanceMatrix to extent

View source: R/crop_cs.R

crop_csR Documentation

Crop conductanceMatrix to extent

Description

Crop conductanceMatrix to extent

Usage

crop_cs(x, extent)

Arguments

x

spatRaster

extent

sf object or terra SpatRaster. Extent obtained from object using terra::ext

Details

conductanceMatrix cropped to extent of supplied Sf object or terra SpatRaster. conductanceMatrix spatRaster dimensions and Matrix dimensions update to reflect cropped extent

Author(s)

Joseph Lewis

Examples


r <- terra::rast(system.file("extdata/SICILY_1000m.tif", package="leastcostpath"))

slope_cs <- create_slope_cs(x = r, cost_function = "tobler", neighbours = 4)

ext <- sf::st_as_sfc(sf::st_bbox(rasterise(slope_cs)))
ext <- sf::st_buffer(ext, dist = -75000)
ext <- sf::st_as_sf(ext)

slope_cs_cropped <- crop_cs(slope_cs, extent = ext)

leastcostpath documentation built on Oct. 10, 2023, 1:06 a.m.