The slope of the digital elevation model (DEM) is used as friction (cost) surface to compute the cost distance from any grid cell of the raster to the river. A characteristic value (default: the mean) of the cost distance distribution in a region surrounding the river (default: a buffer region of 2 km) is then calculated, and used to threshold the cost-distance surface. The resulting area is then "polygonized" to obtain the valley boundary as a simple feature geometry.
Examples
if (!requireNamespace("CRiSpData", quietly = TRUE)) {
message("Install CRiSpData from GitHub to run this example.")
} else {
delineate_valley(terra::unwrap(CRiSpData::bucharest_dem),
CRiSpData::bucharest_osm$river_centerline)
}
#> Geometry set for 1 feature
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: 412402.4 ymin: 4910692 xmax: 448052.6 ymax: 4928318
#> Projected CRS: WGS 84 / UTM zone 35N
#> MULTIPOLYGON (((445998.1 4912232, 445998.1 4912...