Skip to contents

Will find every ID of all segments upstream of the segment selected

Usage

TNETutils_findUpstreamSegment(segments, ID)

Arguments

segments

data.frame All segments in the shapefile. must have the following columns:

gid_newID of the Topage segment
ID_ND_INIID of the initial node of the segment.
ID_ND_FINID of the final node of the segment.
ID

numeric ID of the segment to start the search

Value

a vector with all segments ID found

Examples

# Read exemple shapefile
shape_name <- system.file("extdata","TestNetwork_Ardiere.shp", package = "TnetRUI")
shape_data <- st_read(shape_name)
#> Reading layer `TestNetwork_Ardiere' from data source 
#>   `/tmp/RtmpqHmM8B/temp_libpath18dad4d144539/TnetRUI/extdata/TestNetwork_Ardiere.shp' 
#>   using driver `ESRI Shapefile'
#> Simple feature collection with 121 features and 65 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 814849.3 ymin: 6559414 xmax: 824534.9 ymax: 6568750
#> Projected CRS: RGF93 v1 / Lambert-93

# found all IDs upstream of the segment 1671262
ID_found <- TNETutils_findUpstreamSegment(segments = shape_data, ID=1671262)
ID_found
#> [1] 167126203 167126202 167126201