# GDAL_aspect
# zero_flat argument returns 0 for flat areas instead of -9999. Default is TRUE.
GDAL_aspect <- function(infile, outfile, zero_flat = TRUE, return_raster = FALSE)
{
if (inherits(infile, "Raster"))
{
infile <- infile@file@name
}
if(isTRUE(zero_flat))
{
GDAL_call <- paste0("gdaldem aspect -compute_edges -zero_for_flat", " ", infile, " ", outfile)
} else {
GDAL_call <- paste0("gdaldem aspect -compute_edges", " ", infile, " ", outfile)
}
system(GDAL_call)
if( isTRUE(return_raster)){
r_slope <- raster::raster(outfile)
return(r_slope)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.