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,
...
)
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
.
function: one of the RSAGA geoprocessing functions, such as rsaga.close.gaps()
or rsaga.hillshade()
etc.
logical: are input grids provided as ESRI grids (in.esri=TRUE
) or as SAGA grids?
logical: should output grids be converted to ESRI grids?
RSAGA environment as returned by rsaga.env()
directory for the input and output ESRI ASCII/binary grids
output file format, either "ascii"
(default; equivalent: format=1
) for ASCII grids or "binary"
(equivalent: 0
) for binary ESRI grids (.flt
).
character: "corner"
(equivalent numeric code: 0
) or "center"
(default; equivalent: 1
). Determines whether the georeference will be related to the center or corner of its extreme lower left grid cell.
number of digits when writing floating point values to ASCII grid files (only relevant if out.esri=TRUE
).
extension for input/output ESRI grids: defaults to .asc
for format="ascii"
, and to .flt
for format="binary"
logical: return only results of the RSAGA geoprocessing function fun
(condensed.res=TRUE
), or include the results of the import and export operations, i.e. the calls to rsaga.esri.to.sgrd()
and rsaga.sgrd.to.esri()
? (see Value)
logical: delete intermediate SAGA grid files?
intern
argument to be passed to rsaga.geoprocessor()
; see Value
additional arguments for fun
; NOTE: 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!
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!
rsaga.esri.to.sgrd()
, rsaga.sgrd.to.esri()
, rsaga.geoprocessor()
, rsaga.env()
if (FALSE) {
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.
}
Run the code above in your browser using DataLab