Skip to content

Commit

Permalink
add env. var GRASS_INSTALLATION to initGRASS man page for checking
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbivand committed Feb 28, 2022
1 parent b525a8e commit aa1cc02
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions man/initGRASS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,28 @@ remove_GISRC()

\seealso{\code{\link{gmeta}}}
\examples{
\dontrun{
initGRASS("/usr/bin/grass-7.0.0", home=tempdir())
initGRASS("C:/GRASS", home=tempdir())
GRASS_INSTALLATION <- Sys.getenv("GRASS_INSTALLATION")
run <- FALSE
if (nzchar(GRASS_INSTALLATION)) run <- file.info(GRASS_INSTALLATION)$isdir
run <- require(terra, quietly=TRUE)
if (run) {
f <- system.file("ex/elev.tif", package="terra")
r <- rast(f)
plot(r, col=grDevices::terrain.colors(50))
}
if (run) {
(loc <- initGRASS(GRASS_INSTALLATION, home=tempdir(), SG=r, override=TRUE))
}
if (run) {
write_RAST(r, "elev", flags="overwrite")
execGRASS("r.info", map="elev")
}
if (run) {
execGRASS("r.slope.aspect", flags="overwrite", elevation="elev", slope="slope", aspect="aspect")
}
if (run) {
u1 <- read_RAST(c("elev", "slope", "aspect"), return_format="terra")
plot(u1[["elev"]], col=grDevices::terrain.colors(50))
}
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
Expand Down

0 comments on commit aa1cc02

Please sign in to comment.