calc.stream.dist: Calculate distance along a stream

View source: R/calc.stream.dist.R

calc.stream.distR Documentation

Calculate distance along a stream

Description

Calculate the shortest distance along a stream network between a pair of points

Usage

calc.stream.dist(p1, p2, data)

Arguments

p1

(numeric vector) Longitude and latitude (in that order) of first point

p2

(numeric vector) Longitude and latitude (in that order) of second point

data

(list) Output from prep.data.

Details

This is the primary function for calculating the shortest distance between two points along the stream network.

Value

(numeric) Distance (in meters) between the two points

Examples


data(stream.line)
data(nodes)
data(animal.points)

network.20 <- prep.data(
  l = stream.line,
  freq = 20,
  nodes = nodes,
  lon.name = "lon",
  lat.name = "lat",
  node.name = "id"
)

calc.stream.dist(p1 = c(-88.99845, 17.17668),
 p2 = c(-88.99838, 17.17710),
 data=network.20)



SNMA documentation built on Aug. 27, 2026, 1:08 a.m.