[R-sig-Geo] FYI: Merging GIS and statistics --- RSAGA

Paulo van Breugel p.vanbreugel at gmail.com
Tue Feb 5 14:03:39 CET 2008


Hi I encountered that problem and got in contact with the RSAGA 
maintainer about this problem. He suggested the following (temporary) 
solutions, which works for me:

rsaga.geoprocessor("grid_calculus", 1, list(INPUT="dem.sgrd;brillo.sgrd", RESULT="out2", FORMUL="a/b"),beep.off = FALSE)

In other words, include the beep.off argument, but set it to FALSE 
(defaults to TRUE). Hope this helps, Paulo Message: 8 Date: Mon, 4 Feb 
2008 13:05:41 -0500 From: Al? Santacruz <amsantac at hotmail.com> Subject: 
Re: [R-sig-Geo] FYI: Merging GIS and statistics --- RSAGA To: Tomislav 
Hengl <hengl at science.uva.nl>, <r-sig-geo at stat.math.ethz.ch> Message-ID: 
<BAY120-W29C2E140E80D0B647AD49AC9330 at phx.gbl> Content-Type: text/plain 
Hi, I am trying to use the Grid Calculator in SAGA, through RSAGA but I 
have problems with the parameter FORMUL, I can´t get the function "a/b" 
works, the functions "a+b", or "a-b", or "a*b" works, but "a/b" does 
not, Any help is appreciated, see the code below for the errors 
reported, thanks, Ali Santacruz M.Sc. Geomatics. National University of 
Colombia, Bogota, Colombia E-mail: amsantac at unal.edu.co

------------------------------

Message: 9
Date: Mon, 4 Feb 2008 19:29:37 +0100 (CET)
From: Roger Bivand <Roger.Bivand at nhh.no>
Subject: Re: [R-sig-Geo] FYI: Merging GIS and statistics --- RSAGA
To: Al? Santacruz <amsantac at hotmail.com>
Cc: r-sig-geo at stat.math.ethz.ch
Message-ID: <Pine.LNX.4.64.0802041915160.7596 at reclus.nhh.no>
Content-Type: text/plain; charset="iso-8859-1"

On Mon, 4 Feb 2008, Al? Santacruz wrote:


> >
> >
> > Hi,
> >
> > I am trying to use the Grid Calculator in SAGA, through RSAGA but I have 
> > problems with the parameter FORMUL,
> >
> > I can?t get the function "a/b" works,
> >
> > the functions "a+b", or "a-b", or "a*b" works, but "a/b" does not,
> >
> > Any help is appreciated,
> >
> > see the code below for the errors reported,
> >
> > thanks,
> >
> > Ali Santacruz
> > M.Sc. Geomatics.
> > National University of Colombia,
> > Bogota, Colombia
> > E-mail: amsantac at unal.edu.co
> >
> >
> > ## this formula does not work:
>   
>> >> rsaga.geoprocessor("grid_calculus", 1, 
>> >> list(INPUT="dem.sgrd;brillo.sgrd", RESULT="out2", 
>> >> FORMUL="a/b"))
>> >> C:\Users\geomatica\Desktop
>> >> C:\Users\geomatica\Documents\R\win-library\2.6\RSAGA\saga_vc\saga_cmd.exe
>> >> grid_calculus 1 -silent -INPUT dem.sgrd;brillo.sgrd -RESULT out2 
>> >> -FORMUL a\b
>>     
           ^^^^

A very smokey smoking gun, isn't it? The interface is converting all 
forward slash to backslash (Windows *does* respect forward slash in file 
path names, so this isn't strictly needed), so you'll have to try to 
escape the value until you see a/b coming through. I'm in doubt whether 
you'll have any luck, though:

...
     if (beep.off & .Platform$OS.type=="windows") {
         command = gsub("/","\\",command,fixed=TRUE)
                        ^^^^^^^^
         batch = c("net stop beep",command)
         batchfilename = paste(tempfile(),".bat",sep="")
         batchfile = file(batchfilename,"wt")
         writeLines(batch,con=batchfile)
         close(batchfile)
         command = batchfilename
     }
...

in R/RSAGA-core.R, which converts everything whether a file path or not.

Roger

PS. Is the RSAGA maintainer subscribed to this list?



> >




More information about the R-sig-Geo mailing list