| locate_site | R Documentation |
Finds location of a site (with coordinates X, Y) within a river object.
locate_site(X, Y = NULL, river, euclidean = TRUE, showPlot = FALSE,
xlim = NULL, ylim = NULL)
X |
Either a list or a numeric value. If |
Y |
Latitudinal coordinate of the site. If |
river |
|
euclidean |
Logical. Should the location of the site in the |
showPlot |
Logical. Should a close-up of the relocated site be shown? |
xlim, ylim |
Ranges of x- and y-axis limits for the plot. Only active if |
This function identifies the node in the river network (at the RN and AG levels) that is closest to
an arbitrary site of coordinates X, Y. Only a single site can be processed per function call.
Desired coordinates X, Y can be found in an interactive way by clicking on the river map and using
function locator.
Nodes at the RN level thus found can be defined as new breakpoints for reaches (see aggregate_OCN
and argument breakpoints).
A list with objects:
FDode |
index at the FD level of the node that is closest to ( |
distance |
The distance between |
RNode |
index at the RN level of the relocated site. |
AGode |
index at the AG level of the relocated site. |
par |
List of graphical parameters as produced by a call to |
OCNet::aggregate_OCN, locator
fp <- system.file("extdata/wigger.tif", package = "rivnet")
r <- extract_river(outlet = c(637478, 237413),
DEM = fp)
r <- aggregate_river(r)
X <- 641329; Y <- 227414
out1 <- locate_site(X, Y, r, showPlot = TRUE) # as the crow flies
out2 <- locate_site(X, Y, r, showPlot = TRUE, euclidean = FALSE) # follow downstream path
# define X, Y by clicking on the map
if (interactive()) {
fp <- system.file("extdata/wigger.tif", package = "rivnet")
r <- extract_river(outlet = c(637478, 237413),
DEM = fp)
r <- aggregate_river(r)
plot(r)
point <- locator(1) # click on the map to define point
locate_site(point$X, point$Y, r)
# alternative: specify X as a list and pass river as second argument
locate_site(point, r)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.