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

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.

Example for a computational region
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.

GRASS GIS Database example
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).

GRASS GIS Database versus Geodata formats
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:

  1. Introduction and overviews
  2. Working with computational region: g.region
  3. Map file management
  4. Import raster, vector data, import and project on the fly:
  5. Raster map metadata info, map calculator, univariate statistics, raster stack aggregation: r.info, r.mapcalc, r.univar, r.series
  6. Vector map metadata info, attribute selection, univariate statistics, vector to raster conversion: v.info, v.db.select, v.univar, v.to.rast
  7. 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):

GRASS GIS startup screen
Fig: GRASS GIS startup screen

Enter in the startup dialog:

  1. Select GRASS GIS database directory: /home/youruser/grassdata
  2. Select GRASS Location: ecad17_ll
  3. Select GRASS Mapset: PERMANENT

Please read on in 02_grass-gis_ecad_analysis.md.