download_dem: Download Digital Elevation Model

download_demR Documentation

Download Digital Elevation Model

Description

Download a SRTM 90m resolution (3 arc-seconds) DEM for the entire country and copy it to its corresponding folder.

Usage

download_dem(mainPath, location, alwaysDownload = FALSE, mostRecent = FALSE)

Arguments

mainPath

character; the parent directory of the location folder

location

character; the location folder name

alwaysDownload

logical; should the raster always be downloaded, even if it has already been downloaded? If FALSE and if the raster has already been downloaded the user is interactively asked whether they want to download it again or not.

mostRecent

logical; should the most recent boundary shapefile be selected to define the required DEM tiles? If FALSE and if there are multiple available inputs, the user is interactively asked to select the input based on file creation time.

Details

The function first downloads a SRTM tile grid shapefile from https://github.com/sikli/srtm_country. The SRTM tiles to be downloaded are selected based on the extent of the boundary shapefile and are downloaded using the getData function from the raster package. If there are multiple tiles, a mosaic is produced.

Examples

# Replace workDir with the actual path to your working directory
## Not run: 
mainPath <- "workDir"
initiate_project(mainPath)
## End(Not run)

# Replace myLocation with the location name you are working on (workDir subfolder)
## Not run: 
location <- "myLocation"
download_boundaries(mainPath, location, adminLevel = 1, type = "gbOpen", alwaysDownload = TRUE)
download_dem(mainPath, location, alwaysDownload = TRUE, mostRecent = TRUE)
## End(Not run)

ptimoner/inAccMod documentation built on Jan. 27, 2025, 9:34 a.m.