Introduction to

Helena Mitasova
and Vaclav Petras

GIS/MEA582 Geospatial Modeling and Analysis NCSU

Learning Objectives

This lecture is a brief introduction to GRASS GIS software and overview of its features in the context of this course and open source software in general.

Open Source and Licensing

  • According to Stallman (2002), there are four freedoms that as a user you should have:
    • the freedom to use the software for any purpose,
    • the freedom to change the software to suit your needs,
    • the freedom to share the software, and
    • the freedom to share the changes you make.
Logo of GNU GPL license, version 3

Stallman, R. M. (2002). Free software, free society: selected essays. Ed. by J. Gay. 1st. ed. OCLC: 253840339. Boston, Mass: Free Software Foundation. 220 pp. ISBN 978-1-882114-98-6.

Free, Libre, and Open Source

  • free software (FS), open source software (OSS), free and open source software (FOSS), free, libre and open source software (FLOSS)
  • the term open source is often used for simplicity
    • often used by developers as it refers to a development model
  • the term FOSS is often used in geospatial community
    • free refers to user's freedom
    • open source refers to open development model
    • FOSS4G (free and open source software for geospatial)

Commercial and FOSS

  • FOSS can be used commercially
  • FOSS can be commercial but not proprietary
  • FOSS can be used to build closed platforms
  • Famous FOSS examples (non-geospatial):
    • Red Hat Enterprise Linux/CentOS
    • Android/Android Open Source Project
    • Chrome/Chromium, Firefox
    • WordPress, Drupal
    • Moodle
    • Python, R
    • Apple, Google, Facebook, Amazon, Netflix

FOSS Ecosystem: Example of a Scientific Desktop Setup

GIS, remote sensing, cartography
R, Octave, Python
statistics, linear algebra, scripting, automation
SQLite, PostgreSQL with PostGIS, LibreOffice
database, tabular data
Inkscape, Gimp, ImageMagic
vector graphics, raster graphics
  • Portability: works on Mac, Linux, Windows
  • Interoperability: programs designed to work with others

FOSS Ecosystem: Example of a Service Setup

backend processing
OpenLayers or Leaflet, Django or Flask
front end
PostgreSQL with PostGIS
database (spatial and non-spatial data storage)
ZOO-Project, PyWPS, GeoServer, or QGIS Server
processing server and spatial data publishing server
  • Flexibility: standards and open formats allows to switch different components
  • Scalability: can be copied to more machines at no cost


  • Timeline:
    • 1983 started at US Army CERL as land management system
    • evolved into general purpose GIS
    • 1999 GNU GPL, international team of developers
    • 2008 OSGeo Project
    • 35 years of GRASS GIS development in 2018
    • check out last change (probably just few hours ago)
    • last release Jun 12, 2018 [last checked Aug 2018]

Historical Video

Historical promotional video from 1987 narrated by William Shatner

watching 1 minute is sufficient to get the idea, optionally you can watch the whole 15 minutes and see metadata and transcript at

Processing Capabilities Overview

raster and 3D raster
map algebra, DEM, interpolation, flow, neighborhood, solar, cost surfaces, ...
imagery (remote sensing)
rectification, multispectral, classification, segmentation, PCA, FFT, ...
vector and database
buffers, overlays, networks, topology, attribute management, SQL, ...
spatio-temporal data (time series)
sampling, statistics, aggregation, temporal topology, algebra, ...

General Capabilities Overview

2D display, 3D visualization, temporal visualization, PNG, PS and PDF maps, ...
import from and export to different formats, WMS, ...
scriptable (e.g. Python), custom tools (typically Python or C), ...

Research Use

  • Used as a research platform and code repository
  • Example: Solar radiation model (r.sun)
    • available since 1993
    • major changes in 1996, 1999, 2002, 2003, 2006, 2008, 2017
    • parallelized version in 7.4
  • by Jaroslav Hofierka et al.

summer solstice dynamics on lidar DEM (Centennial Campus)

Software Description

  • portable:
    • many operating systems: MS Windows, Mac OS, Linux, ...
    • 32bit and 64bit versions
    • high-end desktops, low-end laptops, Raspberry Pi, High-Performance Computing clusters, ...
  • single integrated software
  • functionality divided into modules
  • written in C and Python

Naming of Modules

Prefix Functionality Example
r. raster processing r.mapcalc: raster map algebra
v. vector processing interpolation from points
g. general management g.remove: removes maps
d. display and rendering d.rast: display raster map
There is more: i., t., r3., m., ps.

User Interfaces

  • Functionality divided into modules (over 500)
  • Modules can be accessed using:
    • Graphical User Interface (GUI)
    • Command Line Interface (CLI)
    • Python


  • The interface for desktop

GUI for modules

  • All modules have standardized, unified interface layout.

Standard dialog (form) for the r.neighbors module

Command Line

  • The baseline interface for efficiency and reproducibility
  • Available in GUI as Console with autocomplete functions
r.fill.dir input=elev output=fill direction=dir


  • grass package part of GRASS GIS
  • access to modules, but also to internal C functions
  • integrated Python editor
  • integrates with Jupyter Notebooks
import grass.script as gs
gs.run_command('r.fill.dir', input='elev',
               output='fill', direction='dir')

Duality between GUI and commands

Command line (Bash):

Examples in the documentation and class instructions are usually provided as commands which can be used to fill in the GUI, write Python code, or run them directly.

3rd Party Interfaces

  • QGIS (Processing Plugin and GRASS Plugin)
  • R (rgrass7 package)
  • ...

3rd Party Interfaces

  • Tangible Landscape
    • tangible user interface to GRASS GIS and Blender
    • by NC State University, Center for Geospatial Analytics

Modules running:, r.contour, r.fill.dir, r.sim.water

Spatial Database

Example of GRASS GIS database structure into locations (based on SRS) and further to mapsets (for organization)

Selecting Mapset

  • Selecting database, location, and mapset

Computational Region

  • extent and resolution for raster computations

Documentation: Public Author & Accessible Code

Documentation: Link to Research Papers

Asking Questions

  • Mailing list discussions (archived since 1991)
  • GIS StackExchange, ...
  • Commercial support

Addons Repository

  • user contributed modules, plugins, tools, functions
  • distributed to users
  • including compiled C and C++ for MS Windows
  • automatically generated GUI for Python and C/C++

Peer-reviewed Implementation

  • Example:
    • user tested the module
    • discovered error in equation in code


  • Licensing: No "purchasing of licenses" needed for users
  • Support: Community and commercial
    • Students: Start with course message board now; try mailing list or GIS StackExchange later on
  • Several user interfaces
    • Class instructions are using GUI and command line
    • Python and Jupyter are recommended for the projects
  • Data in database, locations and mapsets
  • Raster operations in a specified computational region