Provides a method to manually connect unconnected segments within a river network. The nearest endpoint (or vertex) of the second segment is added as a new vertex to the first, and the network topology is then updated.
connectsegs(connect, connectto, nearestvert = TRUE, rivers, calcconnections = TRUE)
connect | The segment(s) to connect to the network. Typically, this is the segment that is disconnected from the rest of the river network. A vector of segments may be used. |
---|---|
connectto | The segment(s) to connect it (them) to. Typically, this is a segment
that is connected to the rest of the river network. A vector of segments may be used, corresponding to that used in |
nearestvert | Whether to connect at the nearest vertex and split the
segment ( |
rivers | The river network object to use. |
calcconnections | Whether to recalculate all connections.
Defaults to |
A new river network object with the specified segments connected (see rivernetwork)
This function is called within cleanup, which is recommended in most cases.
line2network
data(Koyukuk0) plot(Koyukuk0, ylim=c(1930500,1931500), xlim=c(194900,195100))Koyukuk0.1 <- connectsegs(connect=21, connectto=20, rivers=Koyukuk0)#>plot(Koyukuk0.1,ylim=c(1930500,1931500), xlim=c(194900,195100))Koyukuk0.2 <- connectsegs(connect=c(20,21,22), connectto=c(21,22,23), nearestvert=c(FALSE,FALSE,TRUE), rivers=Koyukuk0)#>