Description Usage Arguments Examples
Execute a Geoscript-groovy or Groovy Script File
1 2 3 4 5 6 | executeGroovyFile(x, inputVar, outputVar = NULL, putOutputNames = FALSE,
command = "jgrass-geoscript-groovy",
command_path = system.file("geoscript-groovy-with-jgrasstools/bin", package
= "rjgrassGroovySmartBridge"), generated.geoscript = paste("temp",
"last_geoscript.groovy", sep = "/"), sys.setenv = list(GROOVY_HOME =
"/usr/local/groovy-2.1.6:/opt/local:/usr"), verbose = TRUE, ...)
|
x |
a S3 |
inputVar |
list with input variables |
outputVar |
list with output variables |
putOutputNames |
logical argument. Default is |
command |
string containing the Groovy command with necessary arguments. |
command_path |
string with the full path to the directory containing the |
generated.geoscript |
file neme of the generated script run by |
sys.setenv |
list of environment variable settings required by |
verbose |
verbose modality. Default is |
... |
further arguments |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | library(rjgrassGroovySmartBridge)
file <- system.file("geoscript-groovy/geomorphological.analysis.groovy",package="rjgrassGroovySmartBridge")
groovy <- parseGroovyFile(file=file)
dem <- system.file("examples/match100m.asc",package="rjgrassGroovySmartBridge")
### INPUT VARIABLE
input <- list()
input$elevAsc <- dem
input$pThresScalar <- 10
## OUTPUT VARIABLE
###output <- list()
outwpath <- system.file("temporary_output",package="rjgrassGroovySmartBridge")
output <- groovy[str_detect(unlist(lapply(X=groovy,FUN=function(x){attr(x,"io.type")})),"output")]
names_output <- names(output)
output <- lapply(X=names(output),FUN=function(x,outwpath){
out <- str_replace(x," ","_")
out <- paste("output",out,sep="_")
out <- paste(outwpath,out,sep="/")
extension <- "asc"
if (str_detect(x,"Asc")) extension <- "asc"
if (str_detect(x,"Shp")) extension <- "shp"
out <- paste(out,extension,sep=".")
return(out)
},outwpath=outwpath)
names(output) <- names_output
executeGroovyFile(groovy,inputVar=input,outputVar=output)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.