R/split_river_with_grid.R
split_river_with_grid.Rd
Splits an 'sf' linestring object at the boundaries of runoff units (polygons).
split_river_with_grid(river, HS, riverID = "riverID", zoneID = "zoneID")
river | An 'sf' linestring feature representing a river network. |
---|---|
HS | A 'HS' object, obtained with |
riverID | A character string which specifies the name of the column in
|
zoneID | Name of the column in |
Returns an 'sf' linestring object which has been split at the polygon (grid) boundaries with attributes (columns):
ID. Unique ID of the split river segments.
riverID. ID of the original river segment prior to splitting.
zoneID. ID of the runoff unit split river segment is contained in.
Other columns inherited from river
.
if (FALSE) { library(raster) library(hydrostreamer) # load data data(river) data(basin) runoff <- brick(system.file("extdata", "runoff.tif", package = "hydrostreamer")) # create HS grid <- raster_to_HS(grid, aoi=basin) splitriver <- split_river_with_grid(river, grid, riverID="ID") }