rsaga.env {RSAGA}R Documentation

Set up the RSAGA Geoprocessing Environment

Description

rsaga.env creates a list with system-dependent information on SAGA path, module path and data (working) directory. Such a list is required by all RSAGA geoprocessing functions.

Usage

rsaga.env( workspace=".", 
    cmd = ifelse(.Platform$OS.type=="windows", "saga_cmd.exe", "saga_cmd"), 
    path, modules, check.libpath = TRUE, check.SAGA = TRUE, 
    check.PATH = .Platform$OS.type == "windows", 
    check.os.default = TRUE,
    os.default.path = ifelse(.Platform$OS.type=="windows", 
        "C:/Progra~1/SAGA-GIS", "/usr/local/bin") )

Arguments

workspace path of the working directory for SAGA; defaults to the current directory (".").
cmd name of the SAGA command line program; defaults to saga_cmd.exe, its name under Windows
path path in which to find cmd; rsaga.env is usually able to find SAGA on your system if it is installed; see Details.
modules path in which to find SAGA libraries; see Details
check.libpath if TRUE (default), first look for SAGA in the folder where the RSAGA package is installed
check.SAGA if TRUE (default), next check the path given by the environment variable SAGA, if it exists
check.PATH if TRUE (default on Windows), next look for SAGA in all the paths in the PATH environment variable; defaults to FALSE on non-Windows OS
check.os.default if TRUE, look for SAGA in the folder specified by os.default.path.
os.default.path C:/Progra~1/SAGA-GIS (under Windows) or /usr/local/bin (under unix)

Details

rsaga.env tries to compile infromation on the SAGA environment; this is not easy because there is no standard installation folder and procedure. If path is missing, rsaga.env first looks for an environment variable SAGA; if this is undefined, it checks the current working directory, then the paths given in the PATH environment variable, and finally the function's guess is "C:/Progra~1/SAGA-GIS" (or "/usr/local/bin" on non-Windows systems).

The default modules folder under Windows is the modules subfolder of the SAGA binaries' folder. The SAGA_MLB environment variable is not being checked. Under Unix, the default modules folder is /usr/local/lib/saga.

Value

A list with components workspace, cmd, path, and modules, with values as passed to rsaga.env or default values as described in the Details section.

Note

Note that the default workspace is ".", not getwd(); i.e. the default SAGA workspace folder is not fixed, it changes each time you change the R working directory using setwd.

The default SAGA folder used to be C:/Progra~1/saga_vc, now it is C:/Progra~1/SAGA-GIS because the most recent SAGA version installs by default in this folder.

Author(s)

Alexander Brenning

Examples

## Not run: 
# Check the default RSAGA environment on your computer:
rsaga.env()
# SAGA data in C:/sagadata, binaries in C:/SAGA-GIS:
myenv <- rsaga.env(workspace="C:/sagadata", path="C:/SAGA-GIS")
# Use the 'myenv' environment for SAGA geoprocessing:
rsaga.hillshade("dem","hillshade",env=myenv)
# ...creates (or overwrites) grid "C:/sagadata/hillshade.sgrd"
# derived from digital elevation model "C:/sagadata/dem.sgrd"
## End(Not run)

[Package RSAGA version 0.9-6 Index]