importToGRASS: Import files to GRASS GIS

View source: R/SOptim_ImportConvertData.R

importToGRASSR Documentation

Import files to GRASS GIS

Description

An auxiliary function used to import raster files into GRASS GIS using r.import command line interface. Inside R the shell function is used to run the temporary a GRASS batch run file which will invoke a single batch file with r.import command.

Usage

importToGRASS(
  fileList,
  GRASS.path = "grass70",
  GRASS.GISDBASE,
  GRASS.LOCATION_NAME,
  GRASS.MAPSET = "PERMANENT",
  addParams = "",
  verbose = TRUE,
  ...
)

Arguments

fileList

A list of complete raster file paths to import to GRASS.

GRASS.path

Defines the initialization path to GRASS .bat file for windows (for example: 'C:/GRASS/grass70') or the .sh or .py file for Linux (usually this should be set to '/usr/bin/grass'). The default is "grass70" which assumes that GRASS is in the path environmental variables and version 7.0.x (which may not be appropriate in most cases and therefore this parameter should be set explicitly).

GRASS.GISDBASE

Name of GRASS GIS database.

GRASS.LOCATION_NAME

Name of GRASS location name (default: "demolocation").

GRASS.MAPSET

Name of GRASS mapset (default: "PERMANENT").

addParams

Additional parameters or flags passed to GRASS GIS r.import() (default: "" - empty string).

verbose

Print messages? (default: TRUE)

...

Further arguments passed to shell.

Details

By default the name of raster files imported to GRASS will have the same file basename as in fileList without the extension (check basename and file_path_sans_ext).

The working directory will be used to place some batch temporary files responsible to run GRASS GIS raster importer through r.import() (for more info check: https://grass.osgeo.org/grass72/manuals/r.import.html).

By default the function will overwrite (flag: --overwrite) any existing file with the same output name and use 1024MB of memory (parameter: memory=1024).


joaofgoncalves/SegOptim documentation built on Feb. 5, 2024, 11:10 p.m.