Create accurate nodes for Drain area calculation
Source:R/TNETshape_computeNdAreaDrain.R
TNETshape_computeNdAreaDrain.Rd
This 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)
#>
Décalage des noeuds [ ] 0%
Décalage des noeuds [> ] 2%
Décalage des noeuds [> ] 5%
Décalage des noeuds [> ] 8%
Décalage des noeuds [=> ] 10%
Décalage des noeuds [=> ] 12%
Décalage des noeuds [==> ] 15%
Décalage des noeuds [==> ] 18%
Décalage des noeuds [===> ] 20%
Décalage des noeuds [===> ] 22%
Décalage des noeuds [====> ] 25%
Décalage des noeuds [====> ] 28%
Décalage des noeuds [=====> ] 30%
Décalage des noeuds [=====> ] 32%
Décalage des noeuds [======> ] 35%
Décalage des noeuds [======> ] 38%
Décalage des noeuds [=======> ] 40%
Décalage des noeuds [=======> ] 42%
Décalage des noeuds [========> ] 45%
Décalage des noeuds [========> ] 48%
Décalage des noeuds [=========> ] 50%
Décalage des noeuds [=========> ] 52%
Décalage des noeuds [==========> ] 55%
Décalage des noeuds [==========> ] 57%
Décalage des noeuds [===========> ] 60%
Décalage des noeuds [===========> ] 62%
Décalage des noeuds [============> ] 65%
Décalage des noeuds [============> ] 68%
Décalage des noeuds [=============> ] 70%
Décalage des noeuds [=============> ] 72%
Décalage des noeuds [==============> ] 75%
Décalage des noeuds [==============> ] 78%
Décalage des noeuds [===============> ] 80%
Décalage des noeuds [===============> ] 82%
Décalage des noeuds [================> ] 85%
Décalage des noeuds [================> ] 88%
Décalage des noeuds [=================> ] 90%
Décalage des noeuds [=================> ] 92%
Décalage des noeuds [==================> ] 95%
Décalage des noeuds [==================> ] 98%
Décalage des noeuds [====================] 100%
data_result <- st_read(result_shape,quiet = TRUE)
head(data_result)
#> Simple feature collection with 6 features and 2 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 821073.4 ymin: 6563727 xmax: 821659.8 ymax: 6564503
#> Projected CRS: RGF93 v1 / Lambert-93
#> gid_new m_recule geometry
#> 1 1291417 30.09042 POINT (821118.7 6564058)
#> 2 2001121 30.24461 POINT (821073.4 6564074)
#> 3 1761027 30.14393 POINT (821345.8 6563727)
#> 4 2687401 30.05369 POINT (821391.9 6563748)
#> 5 1469234 30.04064 POINT (821659.8 6564486)
#> 6 1469351 30.03391 POINT (821625.5 6564503)