| raster2network | R Documentation |
Convert a raster to stream network
raster2network(r, origin)
r |
raster |
origin |
index |
## Not run:
library(raster)
foo <- matrix(0,ncol=9,nrow=9)
foo[1:4,3] <- 1
foo[5,4] <- 1
foo[6:9,5] <- 1
foo <- raster(foo)
origin <- which.min(apply(
which(as.matrix(flip(foo, "y")) == 1, arr.ind = TRUE), 1, sum))
res <- raster2network(foo, origin)
mapview::mapview(res)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.