Calculates direction of travel between two points. Only works if river mouth (lowest point) has been specified (see setmouth).
riverdirection(startseg, endseg, startvert, endvert, rivers, flowconnected = FALSE, stopiferror = TRUE, algorithm = NULL)
| startseg | Segment number of the start of the route |
|---|---|
| endseg | Segment number of the end of the route |
| startvert | Vertex number of the start of the route |
| endvert | Vertex number of the end of the route |
| rivers | The river network object to use |
| flowconnected | If |
| stopiferror | Whether or not to exit with an error if a route cannot be
found. If this is set to |
| algorithm | Which route detection algorithm to use ( |
Direction: "up", "down", or "0" (character). Returns NA if flowconnected==TRUE and the two segments are not flow-connected.
Building routes from the river mouth to each river network segment and/or distance lookup tables will greatly reduce computation time (see buildsegroutes).
data(Gulk) # Mouth must be specified Gulk$mouth$mouth.seg <- 1 Gulk$mouth$mouth.vert <- 1 plot(x=Gulk)riverdirection(startseg=6, endseg=3, startvert=40, endvert=40, rivers=Gulk)#> [1] "down"