R has increasing functionality for analyzing spatial data, but so has GRASS GIS, QGIS and/or SAGA GIS. This course explains how to use GIS software from within R for statistical geocomputing. Specifically, we will execute QGIS and SAGA algorithms from within R to compute terrain attributes.
R-GIS bridges: the examples of RQGIS and RSAGA
This presentation/tutorial explains how to use GIS software from within R for statistical geocomputing. Specifically, we will execute QGIS and SAGA algorithms from within R to compute terrain attributes which we will use as predictors when modeling the floristic composition of Mt. Mongón in the next tutorial (“The importance of spatial cross-validation in predictive modeling).
Materials: Find the code and the presentations in the r_gis_bridges folders of https://github.com/geocompr/geostats_18.
Software requirements: RStudio, R and its packages RQGIS, RSAGA, sf, raster, dplyr and mapview. Please use our install guide (http://jannes-m.github.io/RQGIS/articles/install_guide.html) to install QGIS, SAGA and GRASS on various platforms. Make sure to install QGIS LTR 2.18 since RQGIS so far does not support QGIS 3.
- Muenchow, J., Schratz, P., and A. Brenning. 2017. RQGIS: Integrating R with QGIS for statistical geocomputing. The R Journal 9, 2, 409-428. https://rjournal.github.io/archive/2017/RJ-2017-067/RJ-2017-067.pdf.
- Lovelace, R., Nowosad, J., and J. Muenchow (forthcoming). Geocomputation with R. Chapter 9: Bridges to GIS software. https://geocompr.robinlovelace.net/gis.html. CRC Press.
Link2GI - consistent linking of Open Source GIS with R
The mature open source Geographic Information System (GIS) and Remote Sensing (RS) software like QGIS, GRASS GIS and SAGA GIS provide comprehensive and continually growing collections of highly sophisticated algorithms that are mostly fast, stable and usually well proofed by the community. Although a number of R wrappers aim to bridge this gap (eg rgrass7, RSAGA, RQGIS), they are not that easy to setup for a smooth workflow if one has to work with restricted rights, parallel installations of the same GIS software or cross platform working environments.
The package link2GI provides a small framework for easy linking of R to major GIS software. Here, linking simply means to provide all necessary environment settings as well as full access to the command line APIs of these software tools.