View source: R/shortestroute_cleanup.R
connectsegs | R Documentation |
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.
Matt Tyers
line2network
data(Koyukuk0)
plot(Koyukuk0, ylim=c(1930500,1931500), xlim=c(194900,195100))
topologydots(Koyukuk0, add=TRUE)
Koyukuk0.1 <- connectsegs(connect=21, connectto=20, rivers=Koyukuk0)
plot(Koyukuk0.1,ylim=c(1930500,1931500), xlim=c(194900,195100))
topologydots(Koyukuk0.1, add=TRUE)
# or the vector version
zoomtoseg(seg=21:23, rivers=Koyukuk0)
Koyukuk0.2 <- connectsegs(connect=c(20,21,22), connectto=c(21,22,23),
nearestvert=c(FALSE,FALSE,TRUE), rivers=Koyukuk0)
zoomtoseg(seg=21:23, rivers=Koyukuk0.2)
topologydots(Koyukuk0.2, add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.