View source: R/rasterise_stream.R
rasterise_stream | R Documentation |
Given a shapefile of lines representing the channels of a stream network, this function will return a rasterised version of the shapefile. The raster will have the parameters of the current GRASS mapset.
rasterise_stream(streams, out, overwrite = FALSE, max_memory = 300, ...)
streams |
A file name for a shapefile of stream edges in the current GRASS mapset. |
out |
The filename of the output. |
overwrite |
A logical indicating whether the output is allowed to overwrite existing files. Defaults to |
max_memory |
Max memory used in memory swap mode (MB). Defaults to |
... |
Additional arguments to |
Nothing. A file will be written to out
. Note that out
can be a full file path to any location in your file system. A raster with the name basename(out)
will be written to the current GRASS mapset.
# Will only run if GRASS is running
if(check_running()){
# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")
stream_shp <- system.file("extdata", "streams.shp", package = "rdwplus")
# Set environment parameters and import data to GRASS
set_envir(dem)
vector_to_mapset(vectors = stream_shp)
# Create rasterised stream
rasterise_stream("streams", "streams_rast.tif", overwrite = TRUE)
# Plot
plot_GRASS("streams_rast.tif")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.