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="saga_cmd.exe", path, modules,
    check.libpath=TRUE, check.SAGA=TRUE, check.PATH=TRUE,
    check.windowsdefault=.Platform$OS.type=="windows"  )

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), next look for SAGA in all the paths in the PATH environment variable
check.windowsdefault if TRUE, look for SAGA in the folder C:/Progra~1/saga_vc. While SAGA does not have an installer programm, unpacking the downloaded SAGA zip file would currently create a folder saga_vc. Therefore this should be a good guess.

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_vc".

The default modules folder is the value of the SAGA_MLB environment variable. If this is undefined, the "modules" subfolder of the path folder is rsaga.env's final guess.

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.

There is no guarantee that this package will work with a version of SAGA other than 2.0.2. It is therefore recommended to keep a copy of this SAGA version in the RSAGA library folder, where RSAGA will by default look first SAGA. This version will then be used even if a newer version of SAGA is available somewhere else on your computer.

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_vc:
myenv <- rsaga.env(workspace="C:/sagadata", path="C:/saga_vc")
# 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-1 Index]