Skip to contents

This function takes a DEM and generates altitude bands according to the interval spacing chosen. It also applies different clean up operations that require user specified values for the smoothr::drop_crumbs() and smoothr::fill_holes() functions. These sub-basins, once stored as a shape file can then be further edited in QGIS.

Usage

gen_basinElevationBands(
  dem_PathN,
  dem_FileN = "DEM.tif",
  demAggFact,
  band_interval,
  holeSize_km2,
  smoothFact,
  dem_crs = "+proj=utm +zone=42 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
)

Arguments

dem_PathN

Path to original stored DEM file. Can be path to directory containing the DEM file or the path to the DEM file directly. Can also be a raster object.

dem_FileN

DEM file name (optional, defaults to DEM.tif)

demAggFact

Aggregation factor to down-sample DEM (greatly improves computational efficiency)

band_interval

Elevation bands interval / spacing (in meters)

holeSize_km2

Minimum Size of holes that will be kept during cleaning operation (in square kilometers)

smoothFact

smoothness of final elevation bands (smoothness parameter of smoothr::smooth() function)

dem_crs

crs of the dem as proj string. The default crs in this function is UTM 42N (EPGS: 32642).

Value

Simple feature (sf) multi-polygon. Returns NULL if not successful.

Note

Note that the DEM should be in UTM coordinates because the code works on the units of the projection of the DEM (for example meters in UTM and degrees in lat/long coordinates). We highly recommend to work in UTM.