[R-sig-Geo] RSAGA issues

Jean-Daniel Sylvain jeandaniel.sylvain at gmail.com
Fri Oct 26 13:40:54 CEST 2012


Hi,

For point /1 use this command:

library(rgdal)
image <- 
"E:/IRDA/Automatisation/ScriptDevelopment/data/PredictionProprietesSol/Ref_L5_20000521_IBN7c.sdat"
info <- try(GDALinfo(image), silent = TRUE)


For point 2:

You need to add extension to your 't_codes.sgrd'.

rsaga.geoprocessor(lib="grid_calculus",module=1, 
param=list(GRIDS=InputGridCalc,RESULT=CalcGrid, FORMULA="a+b/2"),env=myenv)


For point 3

a) Use GDALinfo like in point 1 and extract the extent of your file.

b) I'm not sure about what is your problem.

Hope this help.

Jean-Daniel


Le 26/10/2012 3:44 AM, Ludwig Hilger a écrit :
>
> Dear list,
>
> I am comparatively new to RSAGA and have come across three problems I 
> have not been able solve by searching on the internet. Your help would 
> be very much appreciated. This is SAGA 2.0.8 and R 2.15.1.
>
> 1. Is there a way to access the header of a *.sgrd without having to 
> load the whole grid, i.e. not using read.sgrd()$header? I want to 
> determine the cellsize of a *.sgrd from within r for informational 
> purposes and I have 1 m grids with 62 km2.....
>
> ------------------------------------------------------------------------------- 
>
>
> 2. I have tried to call the Grid sum module in the following way:
>     rsaga.geoprocessor(
>     lib = “grid_calculus”,
>     module = 8,
>     param = list(
>     GRIDS = list(“t_elev_class.sgrd”, “t_asp_class.sgrd”),
>     RESULT = “t_codes”
>             )
>     )
>
> I get the following error, i.e. arguments of the function seem to get 
> mixed up:
>
> “library path: C:Program Files (x86)SAGA-GIS_2.0.8/modules
> library name: grid_calculus
> module name : Grids Sum
> author : O. Conrad (c) 2010
>
> Load grid: t_codes...
>
> failed
>
> error: Grid file could not be opened.
>
> error: input file t_codes
>
> error: empty input list GRIDS
> Usage: 8 -GRIDS -RESULT
> -GRIDS: Grids
> Grid list (input)
> -RESULT: Sum
> Grid (output)
>
> error: executing module Grids Sum
> Warnmeldung:
> Ausführung von Kommando '"C:Program Files 
> (x86)SAGA-GIS_2.0.8/saga_cmd.exe" grid_calculus 8 -GRIDS 
> "t_elev_class.sgrd" -RESULT "t_asp_class.sgrd" -GRIDS "t_codes"' ergab 
> Status 1”
>
> I have also tried c() instead of list() for the GRID-argument, I have 
> moeved GRID out of the param-list, etc. . In contrast, 
> rsaga.grid.calculus() works fine. I seem to have the same problem with 
> other modules as well, probably I do not provide the input grids in 
> the right way?
>
> ------------------------------------------------------------------------------- 
>
>
> 3.
> a) When I resample a grid, I have to provide USER_YMIN, USER_XMIN, 
> USER_XMAX and USER_YMAX. Is there a way to automatically calculate 
> these values from the input DEM header and the cellsize selected for 
> resampling (as SAGA seems to do in the GUI)?
> b) If I want to use a target grid as a model for the new grid, where 
> is this to be specified? rsaga.get.usage("grid_tools", 0) gives me 
> only the options GRID_GRID and USER_GRID (which are output arguments 
> according to get.usage). There are no arguments for the path to the 
> target grid.
>
> thank you,
> Ludwig


-- 
Jean-Daniel Sylvain
Consultant en modélisation et analyse spatiale (R&D)
215, rue Alleyn
Québec, Québec
G1K4T7
T. 418-523-7253
P. 418-809-1958

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jeandaniel_sylvain.vcf
Type: text/x-vcard
Size: 386 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20121026/53412fe5/attachment.vcf>


More information about the R-sig-Geo mailing list