rsaga.esri.wrapper | R Documentation |
This wrapper converts input grid files provided in ESRI binary (.flt) or ASCII (.asc) formats to SAGA's (version 2) grid format, calls the RSAGA geoprocessing function, and converts the output grids back to the ESRI grid format. Conversion can also be limited to either input or output grids.
rsaga.esri.wrapper( fun, in.esri = TRUE, out.esri = TRUE, env = rsaga.env(), esri.workspace = env$workspace, format = "ascii", georef = "corner", prec = 5, esri.extension, condensed.res = TRUE, clean.up = TRUE, intern = TRUE, ... )
fun |
function: one of the RSAGA geoprocessing functions, such as |
in.esri |
logical: are input grids provided as ESRI grids ( |
out.esri |
logical: should output grids be converted to ESRI grids? |
env |
RSAGA environment as returned by |
esri.workspace |
directory for the input and output ESRI ASCII/binary grids |
format |
output file format, either |
georef |
character: |
prec |
number of digits when writing floating point values to ASCII grid files (only relevant if |
esri.extension |
extension for input/output ESRI grids: defaults to |
condensed.res |
logical: return only results of the RSAGA geoprocessing function |
clean.up |
logical: delete intermediate SAGA grid files? |
intern |
|
... |
additional arguments for |
ESRI ASCII/float raster file names should NOT include the file extension (.asc, .flt); the file extension is defined by the esri.extension
and format
arguments!
The object returned depends on the condensed.res
arguments and the intern
argument passed to the rsaga.geoprocessor()
.
If condensed.res=TRUE
and intern=FALSE
, a single numerical error code (0: success) is returned. If condensed.res=TRUE
and intern=TRUE
(default), a character vector with the module's console output is returned (invisibly).
If condensed.res=FALSE
the result is a list with components in.res
, geoproc.res
and out.res
. Each of these components is either an error code (for intern=FALSE
) or (for intern=TRUE
) a character vector with the console output of the input (rsaga.esri.to.sgrd()
), the geoprocessing (fun
), and the output conversion (rsaga.sgrd.to.esri()
) step, respectively. For in.esri=FALSE
or out.esri=FALSE
, the corresponding component is NULL
.
Note that the intermediate grids as well as the output grids may overwrite existing files with the same file names without prompting the user. See example below.
rsaga.esri.to.sgrd()
, rsaga.sgrd.to.esri()
, rsaga.geoprocessor()
, rsaga.env()
## Not run: rsaga.esri.wrapper(rsaga.hillshade,in.dem="dem",out.grid="hshd",condensed.res=FALSE,intern=FALSE) # if successful, returns list(in.res=0,geoproc.res=0,out.res=0), # and writes hshd.asc; intermediate files dem.sgrd, dem.hgrd, dem.sdat, # hshd.sgrd, hshd.hgrd, and hshd.sdat are deleted. # hshd.asc is overwritten if it already existed. ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.