# Will only run if a GRASS session is initialised
if(check_running()){
# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")
stream_shp <- system.file("extdata", "streams.shp", package = "rdwplus")
set_envir(dem)
raster_to_mapset(dem)
vector_to_mapset(stream_shp)
# Create binary stream
rasterise_stream("streams", "streams_rast")
reclassify_streams("streams_rast", "streams_binary", out_type = "binary")
# Burn dem
burn_in(dem = "dem.tif", stream = "streams_binary",
out = "dem_burn", burn = 10, overwrite = FALSE)
# Plot
plot_GRASS("dem_burn", col = topo.colors(10))
}
Run the code above in your browser using DataLab