addverts: Add Vertices To Maintain a Minimum Distance Between Vertices

View source: R/shortestroute_cleanup.R

addvertsR Documentation

Add Vertices To Maintain a Minimum Distance Between Vertices

Description

In certain cases, such as when there is a lake within a river system, there may be long, straight lines in a river network with vertices only at either end. In these cases, any point data along these stretches would be snapped to the vertices at either end. This function automatically adds equally-spaced vertices along the straight line, according to a specified minimum allowable distance between vertices.

Usage

addverts(rivers, mindist = 500)

Arguments

rivers

The river network object to use.

mindist

The minimum distance to use between vertices. Defaults to 500.

Value

A new river network object with the specified segments connected (see rivernetwork)

Note

This function is called within cleanup, which is recommended in most cases.

Author(s)

Matt Tyers

See Also

line2network

Examples

data(Kenai3)
Kenai3split <- addverts(Kenai3,mindist=200)

zoomtoseg(seg=c(47,74,78), rivers=Kenai3)
points(Kenai3$lines[[74]])        # vertices before adding

zoomtoseg(seg=c(47,74,78), rivers=Kenai3split)
points(Kenai3split$lines[[74]])   # vertices after adding

riverdist documentation built on Aug. 22, 2023, 5:06 p.m.