View source: R/riverweight_functions.R
get_riverweight | R Documentation |
Get values from a raster at specific locations in a river network. It can be used to
extract relevant values from upstream-averaged rasters as produced by rast_riverweight
.
get_riverweight(x, rst, river, args_locate_site = list())
x |
Coordinate(s) of the location(s) of interest. These can be expressed as a 2-valued vector
(indicating longitudinal and latitudinal coordinate of the single point of interest–in the same
coordinate system as |
rst |
A |
river |
A |
args_locate_site |
List of arguments to be passed to |
A data frame with columns named after the layers of rst
, and as many rows as the number of
rows in x
.
rast_riverweight
, locate_site
data(wigger)
r1 <- terra::rast(system.file("extdata/landcover.tif", package = "rivnet"))
# legend: 1-urban; 2-agriculture; 3-forest; 4-improductive
r.exp <- rast_riverweight(r1, wigger)
v1 <- get_riverweight(c(641000, 226100), r.exp, wigger) # from vector
m <- matrix(c(641000, 226100), 1, 2)
v2 <- get_riverweight(m, r.exp, wigger) # from matrix
df <- data.frame(m)
v3 <- get_riverweight(df, r.exp, wigger) # from data frame
m2 <- matrix(c(641000, 226100, 639600, 226100), 2, 2, byrow = TRUE)
v4 <- get_riverweight(m2, r.exp , wigger) # from matrix multipoint
# use showPlot = TRUE from locate_site to check snapping of point to the river network
v1 <- get_riverweight(c(641000, 226100), r.exp, wigger,
args_locate_site = list(showPlot = TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.