Skip to contents

this function takes a shape and extracts the network above that node Note that this function does not preserve information associated with the original shapefile Future versions should allow the user to specify information to preserve, and allow for

Usage

ExtractBasin(
  shape,
  root,
  basins,
  exclude,
  extract.inner = F,
  attach.data = T,
  upper,
  upper.crs,
  root.tolerance = Inf
)

Arguments

shape

an sf object consisting of linestrings (not multilinestrings!)

root

a sf point, or length 2 vector with xy coordinates

basins

a vector of names or sf feature indicating the basin to be extracted

exclude

vector indexes to be dropped, will attempt to match a single name

extract.inner

logical; should nodes that are in between the basins and the root be extracted

attach.data

logical; should old data fields be obtained; time consuming

upper

a point or points to stop the extraction

upper.crs

a crs string for the upper point, if different from shape

root.tolerance

a tolerance setting for the root. Low values will add the root to the network as a new node.

Value

A sfnetwork containing the specified subbasins