> loc list.files(file.path(loc$GISDBASE, loc$LOCATION_NAME), recursive=TRUE) > f r GRASS_INSTALLATION (GRASS_INSTALLATION)$isdir Here we’ll use a raster file provided with terra: > library(terra) If we don’t pass an existing location to initGRASS(), a temporary GRASS location will be created and set. Starting GRASS from R may use a temporary or an existing GRASS LOCATION. GRASS GIS interface loaded with GRASS version: (GRASS not running) When loaded and attached, rgrass reports that it seems that GRASS is not running: $ GRASS_INSTALLATION=/home/rsb/topics/grass/g820/grass82 R Starting R with such a suitable environment variable set lets us retrieve it later when needed. It may be useful to set an environment variable to the value of GISBASE, as shown for example in the GRASS terminal console: GRASS nc_basic_spm_grass7/rsb:github-rsb > echo $GISBASE This is done by setting GRASS and environment variables from the R session ( ). This screendump shows the same listing of rasters in PERMANENT in rstudio:įrom spgrass6 0.6-3, it has also been possible to start a GRASS session from a running R session using the initGRASS() function. R can also be started within the GRASS GUI, by choosing the console tab, and entering for example rstudio, or another R graphical user interface. Leaving R returns us to the GRASS terminal console, which we can also exit. GRASS nc_basic_spm_grass7/rsb:github-rsb > exit Since rgrass knows the current location, we can for example use execGRASS() to list GRASS rasters in the PERMANENT mapset in the standard North Carolina basic data set ( ): > execGRASS("g.list", type="raster", mapset="PERMANENT") GRASS GIS interface loaded with GRASS version: GRASS 8.2.0 (2022) R version 4.2.1 () - "Funny-Looking Kid"Ĭopyright (C) 2022 The R Foundation for Statistical Computing GRASS nc_basic_spm_grass7/rsb:github-rsb > R Launching GUI in the background, please wait. If required, restart the GUI with: g.gui wxpython Help is available with the command: g.manual -i This version running through: Bash Shell (/bin/bash) Loading and attaching the R-GRASS interface package rgrass in the R session, we see that the current GRASS location is detected and reported: $ /home/rsb/topics/grass/g820/bin/grass /home/rsb/topics/grassdata/nc_basic_spm_grass7/rsb Time to time, you need to recompile everything, so do make distcleanĪnd then start with configuration and continue with compilation and installation.When starting GRASS GIS from a terminal console (here GRASS 8.2.0), one can continue in the GRASS terminal console, starting an interactive R session from there (here R 4.2.1). To update the source code later, use: svn up grass70_release), subdirectory bin, file grass70. You can optionally not install but then you have to run GRASS GIS using full path to the source code directory (. The number after -j is number of cores which should be used for compilation (this may speed up the compilation, it does not influence the result). with-liblas=yes -with-liblas-config=/usr/bin/liblas-config with-mysql=yes -with-mysql-includes="/usr/include/mysql" \ with-postgresql=yes -with-postgres-includes="/usr/include/postgresql" \ with-freetype=yes -with-freetype-includes="/usr/include/freetype2/" \ Go to the directory which was created by svn: cd grass70_release Then to get the latest code for 7.0 release use: svn co grass70_release ~/dev or ~/bin or /usr/local/src or /opt/. Navigate to the directory where you want the code and GRASS GIS to be compiled (e.g. More dependencies: sudo apt-get install libproj-dev Libav-tools libavutil-dev ffmpeg2theora \ Libboost-thread-dev libboost-program-options-dev liblas-c-dev \ Libreadline6 libreadline6-dev libfreetype6-dev \ Wx2.8-headers wx-common libwxgtk2.8-dev libwxgtk2.8-dbg \ Python-dateutil libgsl0-dev python-numpy \ Python-wxversion python-wxtools python-wxgtk2.8 \ Here are the actual steps (partially mine, partially extracted from the wiki page): sudo apt-get update & sudo apt-get upgradeįlex make bison gcc libgcc1 g++ cmake ccache \
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |