Veronica Andreo and the GRASS GIS community
NCSU GeoForAll Lab
at the
Center for Geospatial Analytics
NC State University
useR! Conference, Salzburg, July 8-11, 2024
After a talk with Jakub Nowosad at FOSS4G Europe last week :)
Geek open-source command line GIS
Open-source desktop GIS
Processing backend in QGIS
Data analytics tool in R or quarto notebooks
Geovisualization and data analytics tool in Python notebooks
Geoprocessing engine running in an HPC environment
Geospatial platform for developing custom models
Cloud geoprocessing backend
from grass.pygrass.modules.grid import GridModule
grd = GridModule("v.to.rast", input="roads", output="roads",
use="val", processes=4)
grd.run()
r.mapcalc.tiled "log_dist = if (dist == 0, 0, log(dist))" nprocs=4
Automated download and import of diverse datasets i.eodag, i.sentinel, i.modis, i.landsat, r.in.usgs, r.in.nasadem, m.crawl.thredds, t.rast.import.netcdf, t.stac (on the way!), …
by Fondazione Edmund Mach, OpenGeoLabs, mundialis, GSoC, NC State University, CONICET, Norwegian Institute for Nature Research, …
392 billion cells!
by Markus Metz
Great for workflows when only portion of the data is processed in GRASS GIS.
Only a (dedicated) subset of GRASS tools available through these packages
initGRASS()
: starts a GRASS session from RexecGRASS()
: executes GRASS commands from Rread_VECT()
and read_RAST()
: read vector and raster maps from a GRASS project into Rwrite_VECT()
and write_RAST()
: write vector and raster objects from R into a GRASS projectAccess the full stack of tools and extensions in GRASS GIS from R!!
Assuming we have a terra SpatRast object, r, within our R session:
library(rgrass)
grassbin <- system("grass --config path", intern = TRUE)
initGRASS(gisBase = grassbin,
home = tempdir(),
SG = r,
override = TRUE)
write_RAST(r, "terra_elev")
execGRASS("r.slope.aspect",
elevation = "terra_elev",
slope = "slope",
aspect = "aspect")
grass_maps <- read_RAST(c("aspect", "slope"))
Alternatively...
execGRASS("r.import", input=r, output="terra_elev")
execGRASS("r.external", input="file.tif", output="file") # much faster
grassdata <- path.expand("~/grassdata/")
project <- "nc_basic_spm_grass7"
mapset <- "PERMANENT"
initGRASS(gisBase = grassbin,,
gisDbase = grassdata,
location = project,
mapset = mapset,
override = TRUE,
remove_GISRC= TRUE)
execGRASS("g.list", parameters = list(type="raster"))
elev <- read_RAST("elevation")
# ... plot, run analysis and models, get outputs
write_RAST(elev, "new_elevation")
Support for gdal-grass driver added to read directly from GRASS projects without exporting, thanks to Floris Vanderhaeghe
Ask a question, get a special sticker
veroandreo@gmail.com
veroandreo.github.io/grass-gis-talks
Funded by NSF award 2303651