A few GRASS GIS basics
GRASS GIS is, in general, not much different from other GIS systems while it offers a series of advantages when processing massive datasets, perform geospatial analytics and repair vector topology. Oh, and it is free and open source software.
What you can do with GRASS GIS
- A lot of different topics: Just browse the keyword index of the manual
- Presentation - GRASS GIS 7 capabilities: a graphical overview
- Google Scholar: List of publications related to GRASS GIS
Concept of GRASS GIS database
Raster (incl. aerial imagery and satellite data) and vector data are stored in GRASS internal formats. The rationale is that all of the common GIS formats have some limitations (well, the original GRASS GIS developers just missed the chance in the 1990s to make it an official format through the OGC...).
Hence, all external data files (GeoTIFF, SHAPE, GeoPackage, ...) need to be imported into the GRASS GIS database (which is simply a folder structure with data inside). Espectially for raster maps it is also possible to just link data into the GRASS database (this avoids the almost double disk space consumption). Newly produced maps like analytical results can then be exported to common GIS formats or, in case of vector data, to e.g. PostGIS.
Concept of computational region
The current region or computational region is the actual setting of the region boundaries and the actual raster resolution (see GRASS GIS Wiki).
Raster maps: While the GRASS GIS import tools always import the entire map data, any computation and analysis in the raster model adhere to the so-called computational region which is nothing else that the currently active bounding box and a defined spatial region. Why this? Because raster maps can be large and one may want to first explore a subset of the map. Using the g.region command the active area. To work on the full map, the computational region is simply set to the raster map.
Vector maps: Note that this concept does not apply to vector maps. Vector maps are always processed entirely.
Fig: Example for a computational region
Data management
grassdata
folder (it may have any name): used to store all GRASS GIS data. If you don't have this folder yet just create it in your HOME directory. Optionally, it can also be placed on a shared network device. GRASS GIS is offering multi-user support.- project folders (commonly names "locations"): subfolders in the
grassdata
folder which have to be generated by GRASS GIS itself. - mapset folders: used to organize data with the locations. One default mapset folder, auto-created by GRASS GIS must be there:
PERMANENT
. It carries metadata including projection and can be used to store all base geodata like elevation model etc. inside.
Fig: GRASS GIS Database example
Workflow overview
Working with spatial data in GRASS GIS
When processing spatial data in GRASS GIS, the first step is to import the datasets of interest into GRASS GIS (they can even just be registered to avoid data duplication at the expense of sometimes lower data quality).
Fig: Geodata formats versus GRASS GIS database
As an example, we will further on import the elevation data (above extracted into folder geodata
, file "ecad_v17/elev_v17.tif") required for the exercise. Further data have already been imported in a similar way into the GRASS GIS mapset ecad17
in the location ecad17_ll
in order to not spend too much time here on importing.
Here is a list of some GRASS GIS modules we will be using in this exercise and the links to their manuals:
- Introduction and overviews
- Start page of the GRASS GIS manual
- Raster processing modules
- Vector processing modules
- Imagery processing modules
- General commands to start GRASS GIS, set region, list data: grass78
- Working with computational region: g.region
- Map file management
- Import raster, vector data, import and project on the fly:
- Raster map metadata info, map calculator, univariate statistics, raster stack aggregation: r.info, r.mapcalc, r.univar, r.series
- Vector map metadata info, attribute selection, univariate statistics, vector to raster conversion: v.info, v.db.select, v.univar, v.to.rast
- GRASS GIS addons:
- supervised classification and regression of GRASS rasters using the python scikit-learn package with r.learn.ml
Startup of GRASS GIS
Start it from the menu, or from command line:
# in a terminal, enter
grass78 --gui
The following screen will come up (with slighly different entries but see below):
Fig: GRASS GIS startup screen
Enter in the startup dialog:
- Select GRASS GIS database directory:
/home/youruser/grassdata
- Select GRASS Location:
ecad17_ll
- Select GRASS Mapset:
PERMANENT
Please read on in 02_grass-gis_ecad_analysis.md.