Converts SpatVect of the channel network into SpatVect containing polgons suitable for dynatopGIS

convert_channel(
  chn,
  property_names = c(uid = "uid", startNode = "startNode", endNode = "endNode", slope =
    "slope", class = "class", width = "width", depth = "depth"),
  min_slope = 0.001
)

Arguments

chn

a SpatVect object or a file which can read by terra::vect to create one

property_names

a named vector of containing the columns of existing data properties required in the final SpatialPolygonsDataFrame

min_slope

the minimum slope

Value

A SpatVect containing polygons of the channel network, with at least the following properties: uid, width, depth, slope, startNode and endNode.

Details

The processing follows the follwoing sequence: - The `property_names` input is used to rename the data associated with spatial objects. Remaining data is dropped - Varaibles are converted to the expected type then checked for missing values; in doing this - Missing or lower `slope' values are populated by the min_slope and a warning issued

Examples

chnFile <- system.file("extdata", "gis", "SwindaleRiverNetwork.gpkg",
                       package="dynatop", mustWork = TRUE)
chn <- terra::vect(chnFile)
chn$slope <- 1e-3
chn$class <- 1
chn$width <- 1
chn$depth <- 0.1
chn <- convert_channel(chn,
                       property_names=c(uid = "identifier",
                                        startNode = "startNode",
                                        endNode = "endNode",
                                        slope = "slope",
                                        class = "class",
                                        width="width",
                                        depth="depth"))