dist.per.segment: Calculate distances of stream segments

View source: R/dist.per.segment.R

dist.per.segmentR Documentation

Calculate distances of stream segments

Description

For each segment of a stream, it calculates the distance between each pair of consecutive points and the total distance of that segment (in meters)

Usage

dist.per.segment(
  network,
  nodes,
  lon.name = "lon",
  lat.name = "lat",
  node.name = "id"
)

Arguments

network

(data.frame) A data frame with the the following columns (in this order): "lon", "lat", "id" (the output of increase.stream.points)

nodes

(data.frame) A data frame of coordinates for the nodes where stream segments meet. Coordinates should be in the same projected system as the input to increase.stream.points. Should contain columns for latitude, longitude, and identity of each node (identities must be integers and go from 1 to number of nodes, but they do not need to correspond with anything in the input to increase.stream.points)

lon.name

(character) Name of the column of longitudes (in quotes). Default = "lon"

lat.name

(character) Name of the column of latitudes (in quotes). Default = "lat"

node.name

(character) Name of the column of segment identities (in quotes). Default = "id"

Value

A list containing two objects:

segments = the first object: a data frame with the id of each segment, nodes at either end of the segment, and the total distance (in meters) of that segment.

all.distances = the second object: a list, with one data frame per segment containing the distances between each consecutive pair of points along the line.


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