R/channel_preprocess.R
convert_channel.RdConverts 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
)A SpatVect containing polygons of the channel network, with at least the following properties: uid, width, depth, slope, startNode and endNode.
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
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"))