rsaga.geoprocessor | R Documentation |
This function is the workhorse of the R–SAGA interface: It calls the SAGA command line tool to run SAGA modules and pass arguments.
rsaga.geoprocessor( lib, module = NULL, param = list(), show.output.on.console = TRUE, invisible = TRUE, intern = TRUE, prefix = NULL, flags = ifelse(show.output.on.console, "q", "s"), cores, env = rsaga.env(), display.command = FALSE, reduce.intern = TRUE, check.module.exists = TRUE, warn = options("warn")$warn, argsep = " ", check.parameters = TRUE, ... )
lib |
Name of the SAGA library to be called (see Details). |
module |
Number ( |
param |
A list of named arguments to be passed to the SAGA module (see Examples). |
show.output.on.console |
a logical (default: |
invisible |
a logical, indicates whether the command window should be visible on the screen. |
intern |
a logical, indicates whether to make the output of the command an R object |
prefix |
optional character string: prefix such as |
flags |
optional character string indicating any command line flags; supported only by SAGA GIS 2.1.0 (and higher), quietly ignored otherwise: |
cores |
optional numeric argument, or |
env |
A SAGA geoprocessing environment, i.e. a list with information on the SAGA and SAGA modules paths and the name of the working directory in which to look for input and output files. (Defaults: see |
display.command |
Display the DOS command line for executing the SAGA module (including all the arguments to be passed). Default: |
reduce.intern |
If |
check.module.exists |
logical (default: |
warn |
logical (default: |
argsep |
character (default: |
check.parameters |
logical(default: |
... |
Additional arguments to be passed to |
This workhorse function establishes the interface between the SAGA command line program and R by submitting a system call. This is a low-level function that may be used for directly accessing SAGA; specific functions such as rsaga.hillshade
are intended to be more user-friendly interfaces to the most frequently used SAGA modules. These higher-level interfaces support default values for the arguments and perform some error checking; they should therefore be preferred if available.
A warning is issued if the RSAGA version is not one of 2.0.4-2.0.8 or 2.1.0-2.1.4
The type of object returned depends on the intern
argument passed to system()
.
If intern=FALSE
, a numerical error/success code is returned, where a value of 0
corresponds to success and a non-zero value indicates an error. Note however that the function always returns a success value of 0
if wait=FALSE
, i.e. if it does not wait for SAGA to finish.
If intern=TRUE
(default), the console output of SAGA is returned as a character vector. This character vector lists the input file names and modules arguments, and gives a more or less detailed report of the function's progress. Redundant information can be cancelled out by setting reduce.intern=TRUE
.
Existing output files will be overwritten by SAGA without prompting!
If a terrain analysis function is not directly interfaced by one of the RSAGA functions, you might still find it in the growing set of SAGA libraries and modules. The names of all libraries available in your SAGA installation can be obtained using rsaga.get.libraries()
(or by checking the directory listing of the modules
folder in the SAGA directory). The names and numeric codes of all available modules (globally or within a specific library) are retrieved by rsaga.get.modules()
. Full-text search in library and module names is performed by rsaga.search.modules()
. For information on the usage of SAGA command line modules, see rsaga.get.usage()
, or the RSAGA interface function if available.
display.command=TRUE
is mainly intended for debugging purposes to check if all arguments are passed correctly to SAGA CMD.
Alexander Brenning (R interface); Olaf Conrad and the SAGA development team (SAGA development)
Brenning, A., 2008. Statistical geocomputing combining R and SAGA: The example of landslide susceptibility analysis with generalized additive models. In J. Boehner, T. Blaschke and L. Montanarella (eds.), SAGA - Seconds Out (= Hamburger Beitraege zur Physischen Geographie und Landschaftsoekologie, vol. 19), p. 23-32.
rsaga.env()
, rsaga.get.libraries()
, rsaga.get.modules()
, rsaga.search.modules()
, rsaga.get.usage()
; rsaga.esri.wrapper()
for a wrapper for ESRI ASCII/binary grids; rsaga.hillshade()
and other higher-level functions.
## Not run: rsaga.hillshade("dem","hillshade",exaggeration=2) # using the RSAGA geoprocessor: rsaga.geoprocessor("ta_lighting",0,list(ELEVATION="dem.sgrd",SHADE="hillshade",EXAGGERATION=2)) # equivalent DOS command line call: # saga_cmd.exe ta_lighting 0 -ELEVATION dem.sgrd -SHADE hillshade -EXAGGERATION 2 ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.