Detects cases in which segments should be split to establish appropriate topology, and splits them. Specifically, it looks for segment endpoints intersecting (or within a tolerance of) another segment. It then splits the intersected segment at the point where the endpoint of the other segment breaks it.
splitsegments(rivers, tolerance = NULL, splitthese = NULL, splitthemat = NULL, one2one = FALSE, append = FALSE)
rivers | The river network object to use |
---|---|
tolerance | The spatial snapping tolerance to use for detecting intersection. If a NULL value is used (default), it will default to the tolerance that was used in river network creation in line2network. |
splitthese | An optional vector of target segments to split. If this argument is used, only these segments will be split. If the default ( |
splitthemat | An optional vector of segments (endpoints) to use for splitting. If this argument is used, segments will only be split at the endpoints of these segments. If the default ( |
one2one | Logical, indicating a one-to-one correspondence between arguments |
append | Logical, indicating how to organize the output river network. If |
A new, updated river network object
This function is called within cleanup, which is recommended in most cases.
# Segments 7, 8, 13, and 16 need to be split so topologies will work. # Since endpoints are not in the same place, they are not detected as # being connected. plot(x=Koyukuk1)Koyukuk1split <- splitsegments(rivers=Koyukuk1)#>plot(x=Koyukuk1split)# if only segment 17 were to be split in three places plot(x=splitsegments(rivers=Koyukuk1, splitthese=c(7,7,7), splitthemat=c(14,5,12)))#># if only segment 16 were to be split, showing behavior of append= plot(x=splitsegments(rivers=Koyukuk1, splitthese=c(7,7,7), splitthemat=c(14,5,12), append=TRUE))#>