setup_grass_environment: Setup 'GRASS' environment.

View source: R/setup_grass_environment.R

setup_grass_environmentR Documentation

Setup 'GRASS' environment.

Description

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

Usage

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

Arguments

dem

character; path to DEM.

gisBase

character; the directory path to GRASS binaries and libraries, containing bin and lib subdirectories among others (see details).

epsg

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

sites

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

...

Optional arguments to be passed to initGRASS (see details).

Details

A GRASS session is initiated using initGRASS. The path to the GRASS program must be provided as gisBase. For Linux, this might look like "/usr/lib/grass78/" and for Windows "c:/Program Files/GRASS GIS 7.8". Optional arguments are for example * gisDbase: the GRASS GISBASE directory for this session; defaults to tempdir() * location: name of the location for this session; defaults to tempfile() * override: TRUE for allowing to override an existing location.

Value

Nothing. A GRASS session is initiated and the 'GRASS' mapset is set to PERMANENT. The geographical projection, geographical extension, number of columns and number of rows for the data and the resolution are defined by the dem. They are stored the DEFAULT_WIND file.

Note

It is no longer required to initiate a GRASS session before using initGRASS!

Author(s)

Mira Kattwinkel, mira.kattwinkel@gmx.net

Examples


# path to GRASS
if(.Platform$OS.type == "windows"){
  gisbase = "c:/Program Files/GRASS GIS 7.6"
  } else {
  gisbase = "/usr/lib/grass78/"
  }
# path to the dem   
dem_path <- system.file("extdata", "nc", "elev_ned_30m.tif", package = "openSTARS")
setup_grass_environment(dem = dem_path, 
                        gisBase = gisbase, 
                        location = "nc_example_location",
                        override = TRUE)
gmeta()


MiKatt/openSTARS documentation built on June 17, 2022, 5:08 a.m.