knitr::opts_chunk$set( collapse = TRUE, comment = "#>", echo = T, eval = F )
library(Rsagacmd) library(raster)
First step : install SAGA-GIS (Conrad, O., Bechtel, B., Bock, M., Dietrich, H., Fischer, E., Gerlitz, L., Wehberg, J., Wichmann, V., and Böhner, J. (2015): System for Automated Geoscientific Analyses (SAGA) v. 2.1.4, Geosci. Model Dev., 8, 1991-2007,
Load the Digital Elevation Model (DEM) (1m resolution) in Saga.
Execute : Tools -> Tool Libraries -> Terrain Analysis -> Preprocessing -> Fill Sinks XXL (Wang & Liu) with the loaded DEM and with 'Options : Minimum Slope parameter = 0.1'
This algorithm will produce a 'filled' DEM.
Execute : Tools -> Tool Libraries -> Hydrology -> Flow Accumulation (Top-Down) with the filled DEM (1.) as 'Elevation' grid input with default parameters and Method : 'Multiple Flow Direction'.
Execute : Tools -> Tool Libraries -> Terrain Analysis -> Channels -> Channel Network with the following inputs :
Elevation : The filled DEM computed in 1.
Initiation Grid : The Flow grid obtained in 2.
Initiation Type : 'Greater than'
Initiation Threshold : minimum number of grid cells required to initiate a channel, with a 1m resolution DEM, we selected a value of 2500. This option may influence in a consequent way the obtained Channel Network (check the Spatial Extent of your DEM before setting this value).
Execute : Tools -> Tool Libraries -> Terrain Analysis -> Channels -> Overland Flow Distance to Channel Network with the following inputs :
Elevation : The filled DEM computed in 1.
Channel Network : 'Channel Network' grid computed in 3.
Save 'Vertical Overland Flow Distance' and 'Horizontal Overland Flow Distance' grids as GeoTIFF (*.tif)
Load the both rasters in your R environment,
Vertical Overland Flow Distance : creekverticaldistance in LoggingLab
Horizontal Overland Flow Distance : creekhorizontaldistance in LoggingLab
First step : install SAGA-GIS and the Rsagacmd package.
Load the Digital Elevation Model (DEM) (1m resolution) in R :
DEM <- raster('/YOUR_DEM.tif')
Initialize link between Saga-GIS and Rsagacmd :
Saga <- saga_gis(verbose=TRUE, raster_backend = "raster", vector_backend = "sf")
DEMFilledSinks <- Saga$ta_preprocessor$fill_sinks_xxl_wang_liu(elev = DEM, minslope = .01)
TotalCatchmentArea <- Saga$ta_hydrology$flow_accumulation_top_down(elevation = DEMFilledSinks, method = 'Multiple Flow Direction')
The 'flow' component of the TotalCatchmentArea object will be used as initiation grid for the channel network computation.
ChannelNetwork <- Saga$ta_channels$channel_network(elevation = DEMFilledSinks, init_grid = TotalCatchmentArea$flow, init_method = "Greater than", init_value = 2500)
CreekDistances <- Saga$ta_channels$overland_flow_distance_to_channel_network(elevation = DEMFilledSinks, channels = ChannelNetwork$chnlntwrk)
CreekVerticalDistance <- CreekDistances$distvert # creekverticaldistance crs(CreekVerticalDistance) <- crs(DEM) # set the crs CreekHorizontalDistance <- CreekDistances$disthorz # creekhorizontaldistance crs(CreekHorizontalDistance) <- crs(DEM) # set the crs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.