Calculate the distance from the stream outlet to the upstream node of each edge segment (i.e. upstream distance) in the Landscape Network (LSN)

updist_edges(
  edges,
  lsn_path,
  calc_length = FALSE,
  length_col = NULL,
  save_local = TRUE,
  overwrite = TRUE,
  verbose = TRUE
)

Arguments

edges

An sf object with LINESTING geometry created using lines_to_lsn.

lsn_path

Local pathname to a directory in character format specifying where relationships.csv resides, which is created using link[SSNbler]{lines_to_lsn}.

calc_length

A logical indicating whether a column representing line length should be calculated and added to edges. Default = FALSE.

length_col

Optional. If calc_length = FALSE, length_col is the name of the column in the edges attribute table that contains the length of the edge segment. When calc_length = FALSE, length_col is required. If calc_length = TRUE, length_col is the name of the new column created in edges that will store the new length values for each feature, in character format. When calc_length = TRUE, the default for length_col is "Length".

save_local

Logical indicating whether the updated edges should be saved to lsn_path in geopackage format. Defaults to TRUE.

overwrite

A logical indicating whether results should be overwritten if the upDist column already exists in edges or edges.gpkg already exists in lsn_path and save_local = TRUE. Default = TRUE

verbose

Logical. Indicates whether messages about the function progress should be printed to the console. Defaults to TRUE.

Value

An sf object representing edges in the LSN, with a new upDist column.