Create accurate nodes for Drain area calculation
Source:R/TNETshape_computeNdAreaDrain.R
TNETshape_computeNdAreaDrain.RdThis function will create accurate nodes to calculates drain area of all segments. All nodes between confluences
are kept the same. Confluences nodes are mooved upstream depending on DEM resolution and distance with other segments.
This function id used by TNETshape_computeAreaDrain().
Usage
TNETshape_computeNdAreaDrain(path_segments, path_node, path_export, res_mnt,ID_special = NULL, suffix_export='')Arguments
- path_segments
string Path to the shapefile with segments to merge.
- path_node
string Path to the shapefile with all segments nodes.
- export_file
string Path to the shapefile with results to create.
- res_mnt
numeric Resolution of the MNT use to calculate drain area (in meter)
- ID_special
data.frame to move upstream specific segments node with a specific distance determined by the user. It must contain the following columns:
\(gid\_new\) ID of the Topage segment \(Recul\) specific distance to moved the node upstream
Details
Here is a figure on how nodes are moved at the confluences. Nodes not at confluences remain at the same position.

Examples
## Read test files
shape_name <- system.file("extdata","TestNetwork_Ardiere.shp", package = "TnetRUI")
shapeND_name <- system.file("extdata","TestNetwork_ND_Ardiere.shp", package = "TnetRUI")
#run computation
result_shape <- "test/Network_NDareaDrain.shp"
TNETshape_computeNdAreaDrain(path_segments = shape_name,
path_node = shapeND_name,
res_mnt = 10,
export_file = result_shape)
#> Error: `dsn` must point to a source, not an empty string.
data_result <- st_read(result_shape,quiet = TRUE)
#> Error: Cannot open "test/Network_NDareaDrain.shp"; The file doesn't seem to exist.
head(data_result)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'data_result' not found