retrieve_raster {rdwplus}R Documentation

Write a raster layer from the current GRASS mapset to file

Description

This function writes a GRASS mapset raster to file.

Usage

retrieve_raster(layer, out_layer, overwrite = FALSE, ...)

Arguments

layer

The name of the raster in the GRASS mapset that is to be written out.

out_layer

The name of the file to be created, with the relevant file extension.

overwrite

A logical indicating whether the output from this function should be allowed to overwrite any existing files. Defaults to FALSE.

...

Additional arguments to r.out.gdal.

Value

Nothing.

Examples

# Will only run if GRASS is running
if(check_running()){

# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")

# Set environment parameters and import data to GRASS
set_envir(dem)
raster_to_mapset(rasters = dem, as_integer = FALSE)

# Retrieve raster 
out_name <- paste0(tempdir(), "/retrieved_dem.tif")
retrieve_raster("dem.tif", out_layer = out_name, overwrite = TRUE)

}

[Package rdwplus version 1.0.0 Index]