The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

RGDrivers

library(RGDrivers)
library(terra)
#> terra 1.9.34

Introduction

RGDrivers provides tools for analyzing stream networks, including the construction of directed graphs from stream reaches, the calculation of Link Magnitude (Shreve stream order) and D-LINK (downstream reach order), and the export of results back to a spatial file.

This vignette uses the small sample set of stream reaches included in the package (inst/extdata/rede_exemplo.gpkg).

Loading the sample data

network <- vect(system.file("extdata", "rede_exemplo.gpkg", package = "RGDrivers"))
network
#> class       : SpatVector
#> geometry    : lines
#> dimensions  : 3, 2  (geometries, attributes)
#> extent      : 0, 3, 0, 3  (xmin, xmax, ymin, ymax)
#> source      : rede_exemplo.gpkg
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> names       :    id   jus
#> type        : <num> <num>
#> values      :     1     2
#>                   2     3
#>                   3    NA

Creating the directed graph

g <- create_network_graph(network, col_id = "id", col_downstream = "jus")
g
#> IGRAPH 6590aea DN-- 3 2 -- 
#> + attr: name (v/c)
#> + edges from 6590aea (vertex names):
#> [1] 1->2 2->3

Writing the result to a new spatial vector

network$link_mag <- df$link_mag
network$D_LINK <- df$D_LINK

output <- tempfile(fileext = ".gpkg")
write_network_with_orders(
  original_vector = network,
  updated_df = df,
  col_id = "id",
  additional_cols = c("link_mag", "D_LINK"),
  output_path = output
)
file.exists(output)
#> [1] TRUE

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.