Unit 03 - Data Management

Data can be imported simply from toolbar in Data tab by tools dedicated for raster grass-raster-import or vector grass-vector-import GIS data formats. Basic knowledge of commonly used GIS file formats is required.


GRASS terminology differs from commonly used GIS packages. To avoid confusion let’s focus on the most important terms. Commonly used term “a layer” is called in GRASS “a map”. While GRASS layer is a subset of features within one “map”. So “GRASS raster map” can be treated as “a raster layer” in other GIS packages.

Data used in this unit is located in geodata/sentinel/sample directory of a sample dataset.

Raster data

Let’s import sample Sentinel-2 4th band L2A_T32UPB_20170706T102021_B04_10m.jp2 file. Data is stored in JPEG2000 data format, which is nowadays commonly used GIS raster format for imagery data. Raster data can be imported into GRASS from the toolbar grass-raster-import Import raster data [r.import] or from the menu File ‣ Import raster data ‣ Simplified raster import with reprojection.

Import dialog allows importing single raster file (File) or multiple files from directory (Directory). In our case single file is planned to be imported.


Fig. 17 Select input raster file to be imported.


Fig. 18 Imported raster data is automatically displayed in Map Display window. Progress of import is shown in Console tab. Default color table is not perfect as you can see, color interpretation will enhanced in Unit 04.


GRASS imports/links RGB image as separate bands. Color composition can be displayed using d.rgb.

Basic raster metadata can be printed by r.info or from Layers tab.


Fig. 19 Show raster metadata from contextual menu.


Fig. 20 Detail of raster metadata.

Raster maps are represented by regular grid. Three data types are supported:

  • CELL (integer)
  • FCELL (float)
  • DCELL (double)

Vector data

Let’s import sample vector cloud mask data layer from geodata/sentinel/sample/MSK_CLOUDS_B00.gml GML file (commonly used GIS exchange vector data format). Vector data can be imported into GRASS from the toolbar grass-vector-import Import vector data [v.import] or from the menu File ‣ Import vector data ‣ Simplified vector import with reprojection).


Fig. 21 Select input vector file to be imported.


Fig. 22 Imported vector data is automatically displayed in Map Display window. Progress of import is shown in Console tab. Map composition of Sentinel-2 4th band and cloud mask features.



If a spatial reference system (SRS) of raster/vector file differs from GRASS location (Project match) input data is automatically reprojected into SRS of the current GRASS location. Note that GRASS simply does not support on the fly transformation from several reasons.


In some cases SRS of imported file can be missing or invalid. GRASS reports this issue as In case of no significant differences in the projection definitions, use the -o flag to ignore them and use current location definition. Consider generating a new location from the input dataset using the ‘location’ parameter.

GRASS allows importing such file by overriding project check (if you are really sure that SRS of input file is the same as GRASS location).

Vector topology

Let’s take a closer look at vector metadata of imported administrative regions. Instead of “polygons” there are “areas” and other kind of primitives (points, lines, boundaries, centroids, isles), see Fig. 23.


Fig. 23 Vector metadata of imported file.

GRASS GIS is a topological GIS. Importing vector data into GRASS also means converting features from simple feature model (points, linestrings, polygons, …) into GRASS topological model.


Fig. 24 GRASS topological model with primitives (nodes, lines, boundaries, centroids, areas, and isles).

Topological errors are checked and repaired by GRASS GIS when importing data, be awere of snap option of v.import module. Topological errors which is not possible repair automatically without user specification can fixed using v.clean module.

Linking external formats

To avoid data duplication GRASS also allows linking raster data using r.external (Link external raster data) and vector data by v.external (Link external vector data) which are also accessible from the toolbar grass-layer-import in Data tab.


Fig. 25 Link raster or vector data.

Linking data is mainly recommended when working with raster data such large datasets of imagery data. GRASS can handle linked raster data similarly as native raster maps. Both from point of stability and accessibility.