mouthdist: Distance From Mouth

Description Usage Arguments Value Note Author(s) Examples

View source: R/apps_of_direction.R

Description

Calculates distance from river locations (given as vectors of segment and vertex) and the specified mouth of the river network. The mouth must first be specified (see setmouth).

Usage

1
mouthdist(seg, vert, rivers, stopiferror = TRUE, algorithm = NULL)

Arguments

seg

Vector of segments

vert

Vector of vertices

rivers

The river network object to use

stopiferror

Whether or not to exit with an error if a route cannot be found. If this is set to FALSE and a route cannot be found, the function will return NA in the appropriate entry. Defaults to TRUE. See detectroute.

algorithm

Which route detection algorithm to use ("Dijkstra", "sequential", or "segroutes"). If left as NULL (the default), the function will automatically make a selection. See detectroute for more details.

Value

Distance (numeric)

Note

Building routes from the river mouth to each river network segment and/or distance lookup tables will greatly reduce computation time (see buildsegroutes).

Author(s)

Matt Tyers

Examples

1
2
3
4
5
6
7
8
data(Gulk)

# Mouth must be specified
Gulk$mouth$mouth.seg <- 1
Gulk$mouth$mouth.vert <- 1

mouthdist(seg=4, vert=40, rivers=Gulk)
mouthdist(seg=c(4,5), vert=c(40,20), rivers=Gulk)

Example output

[1] 79793.2
[1]  79793.2 105133.2

riverdist documentation built on Sept. 10, 2021, 9:06 a.m.