Description Usage Arguments Value Author(s) See Also Examples
Convert flow accumulation raster to line segments and plot it.
This enables much faster drawing, making it suitable e.g. for drawing small
maps with the river added on top in the corner of plots, e.g. with
berryFunctions::smallPlot
as in the example.
1 2 3 |
dem |
List returned by |
proj |
Projection passed to |
prop |
Proportion of catchment areas (of each raster cell) beyond which a channel counts as river. Lower values mean longer stretches identified as rivers. DEFAULT: 0.98 |
col |
Color scale. DEFAULT: |
lwd |
Line width range. DEFAULT: 1:6 |
add |
Logical: add to existing plot? DEFAULT: FALSE |
legend |
Logical: add |
title |
Character: Legend title. DEFAULT: "Catchment area [1000 km^2]" |
legargs |
List of arguments passed to |
quiet |
Logical: should progress messages be suppressed? DEFAULT: FALSE |
... |
Further arguments passed to |
data.frame with segment indices
Berry Boessenkool, berry-b@gmx.de, Mar 2017
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # To be added
if(FALSE){
dem <- read_dem("U:/mHM_shared/basel_6935051/input/morph", proj=3035)
op <- par(no.readonly=TRUE)
vis_dem(dem, png=FALSE)
riv <- vis_river(dem)
par(op)
ca <- riverlines(dem, riv, col="orange")
# for large catchments, computing is time consuming, so plotting can be outsourced
library(berryFunctions)
logHist(dem$facc*(facc$cellsize/1000)^2, breaks=30) # km^2
}
# Add rivers as small plot
## Not run: ## Not run in CRAN checks to avoid downloading background map
library(OSMscale)
map <- pointsMap(lat=riv$y, lon=riv$x, zoom=7, proj=pll(), plot=F)
par(mar=c(0,0,0,0))
plot(map, removeMargin=FALSE)
vis_river(facc, add=TRUE, lwd=1:3)
par(op)
plot(cumsum(rnorm(300)), type="l") # some gauge properties, e.g.
smallPlot({
plot(map, removeMargin=FALSE)
vis_river(facc, add=TRUE, lwd=1:3, legend=FALSE)
points(8, 47.55, col="red", pch=3, lwd=3, cex=2)
}, x1=0, x2=0.4, y1=0.77, y2=1, mar=0, border=NA, bg=NA)
## End(Not run) # end dontrun
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.