run <- FALSE
if (nchar(Sys.getenv("GISRC")) > 0 &&
read.dcf(Sys.getenv("GISRC"))[1,"LOCATION_NAME"] == "nc_basic_spm_grass7") run <- TRUE
oechoCmd <- get.echoCmdOption()
set.echoCmdOption(TRUE)
if (run) {
print(parseGRASS("r.slope.aspect"))
}
if (run) {
doGRASS("r.slope.aspect", flags=c("overwrite"),
elevation="elevation.dem", slope="slope", aspect="aspect")
}
if (run) {
pars <- list(elevation="elevation", slope="slope", aspect="aspect")
doGRASS("r.slope.aspect", flags=c("overwrite"), parameters=pars)
}
if (run) {
print(parseGRASS("r.buffer"))
}
if (run) {
doGRASS("r.buffer", flags=c("overwrite"), input="schools", output="bmap",
distances=seq(1000,15000,1000))
}
if (run) {
pars <- list(input="schools", output="bmap", distances=seq(1000,15000,1000))
doGRASS("r.buffer", flags=c("overwrite"), parameters=pars)
}
if (run) {
set.echoCmdOption(oechoCmd)
try(res <- execGRASS("r.stats", input = "fire_blocksgg", # no such file
flags = c("C", "n")), silent=FALSE)
}
if (run) {
res <- execGRASS("r.stats", input = "fire_blocksgg", flags = c("C", "n"),
legacyExec=TRUE)
print(res)
}
if (run) {
if (res != 0) {
resERR <- execGRASS("r.stats", input = "fire_blocksgg",
flags = c("C", "n"), redirect=TRUE, legacyExec=TRUE)
print(resERR)
}
}
if (run) {
res <- stringexecGRASS("r.stats -p -l input=geology", intern=TRUE)
print(res)
}
if (run) {
stringexecGRASS(paste("r.random.cells --overwrite --quiet output=samples",
"distance=1000 ncells=100 seed=1"))
}
if (run) {
execGRASS("r.random.cells", flags=c("overwrite", "quiet"), output="samples", distance=1000,
ncells=100L, seed=1L)
}
Run the code above in your browser using DataLab