knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>", echo = T, eval = F
)
library(Rsagacmd)
library(raster)

Creek Distances computation

Method 1 : Using Saga-GIS graphical user interface

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, .) : https://saga-gis.sourceforge.io/

Save 'Vertical Overland Flow Distance' and 'Horizontal Overland Flow Distance' grids as GeoTIFF (*.tif)

Load the both rasters in your R environment,

Method 2 : Using Saga-GIS and Rsagacmd

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")

1 - Fill Sinks XXL (Wang & Liu)

DEMFilledSinks <- Saga$ta_preprocessor$fill_sinks_xxl_wang_liu(elev = DEM, 
                                                               minslope = .01)

2 - Flow Accumulation (Top-Down)

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.

3 - Channel Network

ChannelNetwork <- Saga$ta_channels$channel_network(elevation = DEMFilledSinks,
                                                   init_grid = TotalCatchmentArea$flow,
                                                   init_method = "Greater than",
                                                   init_value = 2500) 

4 - Overland Flow Distances To Channel Network

CreekDistances <- Saga$ta_channels$overland_flow_distance_to_channel_network(elevation = DEMFilledSinks,
                                                                             channels = ChannelNetwork$chnlntwrk)

5 - Extract Creek Horizontal and Vertical Distances

CreekVerticalDistance <- CreekDistances$distvert # creekverticaldistance 

crs(CreekVerticalDistance) <- crs(DEM) # set the crs

CreekHorizontalDistance <- CreekDistances$disthorz # creekhorizontaldistance 

crs(CreekHorizontalDistance) <- crs(DEM) # set the crs


VincyaneBadouard/LoggingLab documentation built on Oct. 16, 2024, 9:42 p.m.