Unit 02 - First steps¶

Starting a GRASS session requires basic knowledge about software itself. It is an obstacle especially for newcomers. In other words GRASS forces organizing your data from early beginning.

Before entering GRASS a startup screen appears, the user must define working project in which GRASS session will operate. Without this step you cannot enter GRASS. Such approach is not so common. Applications like Esri ArcGIS or QGIS just starts. The user loads different data from various data sources in different projections, and starts working on his/her project. GRASS is different, which makes this software harder to enter for newcomers. But don’t worry, we will enter our first GRASS sessions in few steps.

The GRASS GIS startup screen requires to set up three items:

1. Database directory. A directory on local or network disc which contains all data accessed by GRASS. It’s usually directory called grassdata located in a user’s home directory. This item is set up on Windows automatically, so usually you don’t need to care about it.
2. Location. Plays a role of “a project”. All geodata stored within one location must have the same spatial coordinate system (GRASS doesn’t support on-the-fly projection from several reasons).
3. Mapset Contains task-related data within one project. Helps organizing data into logical groups or to separate parallel work of more users on the same project.

Fig. 4 GRASS GIS startup screen.

At first define database directory (1.) if not already set up. Then a new location can be created (2a.) or official GRASS sample location(s) downloaded (2b.). Let’s create our own location, a project related to Jena region.

Note

Create a new location¶

A new GRASS location can be easily created by EPSG code or available input geodata. After pressing New button, see Fig. 4 (2a.), the Location Wizard shows up.

In the first page of a wizard, a location name is defined, optionally also short description can be added.

Fig. 5 Define a name for new GRASS location.

Then a method for creating new location is chosen. Usually a location is created using given EPSG code (Select EPSG code of spatial reference system) or from existing data (Read projection and datum terms from a georeferenced data file). In our case a new location will be created based on sample Jena administrative boundary vector layer.

Fig. 6 Choose method for creating a new GRASS location.

In the next page define an input file.

Fig. 7 Define an input file jena_boundary.gpkg (available from geodata/osm directory).

Note

Jena administrative boundary has been downloaded from OpenStreetMap project using Overpass API by GDAL library (ogr2ogr utility). Downloaded data is stored in OGC GeoPackage format (we don’t like an old-school Esri Shapefile format). Data is reprojected to UTM zone 32N (EPSG:32632) since we want to work with Sentinel data afterwards, see Unit 03 - Data Management.

ogr2ogr -f GPKG jena_boundary.gpkg -a_srs EPSG:4326 -t_srs EPSG:32632 \
/vsicurl_streaming/"http://overpass-api.de/api/interpreter?data=%28relation\
name%22%3D%22Jena%22%5D%3B%29%3B%28%2E%5F%3B%3E%3B%29%3Bout%3B%0A" multipolygons


The URL has been generated by http://overpass-turbo.eu (Export ‣ Query ‣ compact OverpassQL) using the query below:

(
relation
["name"="Jena"]
);
(._;>;);
/*end of auto repair*/
out;


Spatial reference system is chosen based on input file (UTM zone 32N EPSG:32632).

Fig. 8 Check the summary.

After creating a new location (Finish button) the user can optionally import data used for defining the new location (in our case jena_boundary.gpkg).

Fig. 9 Let’s import data to simplify our first steps in GRASS GIS.

Now we can finally start a GRASS session by entering our first GRASS location.

Fig. 10 Entering a GRASS session.

Note

By default GRASS creates in a new location a PERMANENT mapset. Let’s keep it simple at this moment and enter PERMANENT mapset. Later we will try organizing our work into more mapsets.

Display data¶

GRASS GUI is designed as a simple and lightweight user interface. Basically it is just a GUI front-end calling GRASS commands (see Accessing GRASS modules) in the background. After startup, the GUI appears. It consists of two main windows: Layer Manager and Map Display, see Fig. 11.

Fig. 11 Main GUI components: Layer Manager and Map Display.

Tip

If GUI crashes, it can be started again by g.gui command from underlaying terminal (command prompt).

Let’s display already imported vector data layer jena_boundary. Use Data tab, main menu File ‣ Map display ‣ Add vector or a toolbar Add vector map layer icon.

Fig. 12 Display Jena city administrative boundary vector layer. Select Display layer from contextual menu in Data tab or simply use double-click on the desired layer.

Tip

Unpack basemap layer from geodata/osm/basemap.pack (File ‣ Import raster map ‣ Unpack raster map).

Fig. 13 A map composition of basemap and boundary of Jena city region in red color.

Todo

Fix WMS reprojection in GRASS GIS.