Learn R Programming

openSTARS (version 1.1.0)

setup_grass_environment: Setup 'GRASS' environment.

Description

This function sets the 'GRASS' mapset to PERMANENT and sets its projection and extension.

Usage

setup_grass_environment(dem, epsg = NULL, sites = NULL)

Arguments

dem

character; path to DEM.

epsg

integer; EPSG code for the projection to use. If not given (default) the information is taken from the dem

sites

(deprecated); not used any more. Only included for compatibility with previous version.

Value

Nothing, the 'GRASS' mapset is set to PERMANENT, the projection and the extent of the current location is set to the one of the dem.

Examples

Run this code
# NOT RUN {
# Initiate GRASS session
if(.Platform$OS.type == "windows"){
  gisbase = "c:/Program Files/GRASS GIS 7.4.0"
  } else {
  gisbase = "/usr/lib/grass74/"
  }
initGRASS(gisBase = gisbase,
    home = tempdir(),
    override = TRUE)

# Load files into GRASS
dem_path <- system.file("extdata", "nc", "elev_ned_30m.tif", package = "openSTARS")
setup_grass_environment(dem = dem_path)
gmeta()
# }

Run the code above in your browser using DataLab