Get all SAFRAN gris ID info from shapefile
Source:R/TNETutils_getSAFRAN_fromShape.R
TNETutils_getSAFRAN_fromShape.Rd
Get all info of SAFRAN grid where all river segments are located from the T-NET readable format to a better R understanding format.
Arguments
- shapefile
Path to the shapefile with all info on segments. It must contain the following columns:
\(gid\_new\) ID of the Topage segment \(ID\_M\_1\) ID of the SAFRAN grid n°1 where the segment is located \(ID\_M\_2\) ID of the SAFRAN grid n°2 where the segment is located \(ID\_M\_3\) ID of the SAFRAN grid n°3 where the segment is located \(ID\_M\_4\) ID of the SAFRAN grid n°4 where the segment is located \(ID\_M\_5\) ID of the SAFRAN grid n°5 where the segment is located \(ID\_M\_6\) ID of the SAFRAN grid n°6 where the segment is located \(ID\_M\_7\) ID of the SAFRAN grid n°7 where the segment is located \(ID\_M\_8\) ID of the SAFRAN grid n°8 where the segment is located \(Rap\_M\_1\) Part of the segment located in SAFRAN grid n°1 \(Rap\_M\_2\) Part of the segment located in SAFRAN grid n°2 \(Rap\_M\_3\) Part of the segment located in SAFRAN grid n°3 \(Rap\_M\_4\) Part of the segment located in SAFRAN grid n°4 \(Rap\_M\_5\) Part of the segment located in SAFRAN grid n°5 \(Rap\_M\_6\) Part of the segment located in SAFRAN grid n°6 \(Rap\_M\_7\) Part of the segment located in SAFRAN grid n°7 \(Rap\_M\_8\) Part of the segment located in SAFRAN grid n°8
Examples
# example code
#Shapefile name
file <- path/to/shapefile.shp
#> Error: object 'to' not found
read_sf(file)
#> Error in as.character(dsn) :
#> cannot coerce type 'closure' to vector of type 'character'
#> Error in st_read.default(..., quiet = quiet, stringsAsFactors = stringsAsFactors, as_tibble = as_tibble): no st_read method available for objects of class function
#> | gid_new | ID_M_1 | ID_M_2 | ID_M_3 | ID_M_4 | ID_M_5 | ID_M_6 | ID_M_7 | ID_M_8 | Rap_M_1 | Rap_M_2 | Rap_M_3 | Rap_M_4 | Rap_M_5 | Rap_M_6 | Rap_M_7 | Rap_M_8|
#> |---------|--------|--------|--------|--------|--------|--------|--------|--------|---------|---------|---------|---------|---------|---------|---------|--------|
#> |145 |6331 |6332 |NaN |NaN |NaN |NaN |NaN |NaN |0.65 |0.35 |NaN |NaN |NaN |NaN |NaN |NaN |
#> |189 |6330 |NaN |NaN |NaN |NaN |NaN |NaN |NaN |1 |NaN |NaN |NaN |NaN |NaN |NaN |NaN |
#> |160195 |7852 |7856 |7851 |NaN |NaN |NaN |NaN |NaN |0.42 |0.18 |0.4 |NaN |NaN |NaN |NaN |NaN |
safran <- TNETutils_getSAFRAN_fromShape(file)
#> Error in setDT(shapefile): Argument 'x' to 'setDT' should be a 'list', 'data.frame' or 'data.table'
safran
#> Error: object 'safran' not found
#> | gid_new | SAFRAN | Rapport |
#> |---------|--------|----------|
#> | 145 | 6331 | 0.65 |
#> | 145 | 6332 | 0.35 |
#> | 189 | 6330 | 1 |
#> | 160195 | 7852 | 0.42 |
#> | 160195 | 7856 | 0.18 |
#> | 160195 | 7851 | 0.4 |