Unit 03 - Data Management¶
Data can be imported simply from toolbar by tools dedicated for raster or vector GIS data formats . Basic knowledge of commonly used GIS file formats is required.
Note
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”. GRASS layer is subset of features with one “map”. So “GRASS raster map” can be treated as “a raster layer” in other GIS packages.
Import GIS data¶
Raster data¶
Let’s start with data file used for creating our project location in
Unit 02 - First steps. L2A_T32VNM_20170705T105031_B04_10m.jp2
is a
JPEG2000 file, which is nowadays commonly used GIS
raster format for imagery data.
Note
Dialog for importing raster data is also accessible from menu r.import module.
or from command line byImport dialog allows importing single vector file (File) or multiple files from directory (Directory). In our case single file is planned to be imported, we keep default data source (File).
Important
If a spatial reference system (SRS) of raster file differs from GRASS location (Project match) input raster data are automatically reprojected into SRS of current GRASS location. Note that GRASS simply does not support on the fly transformation from several reasons.
Note
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).
After successful operation imported data layer should be automatically displayed in Map Window.
Note
GRASS imports/links RGB image as separate bands. Color composition can be displayed using d.rgb. By r.composite it is possible to create color composite as a new raster map.
Vector data¶
Norway administrative regions are stored in
~/geodata/counties/Basisdata_0000_Norge_25833_Fylker_GML.gml
GML file, which is a commonly used GIS exchange vector
format.
Note
Dialog for importing vector data is also accessible from menu v.import module.
or from command line byIn this case appearently SRS of input data layer and current GRASS location differs (see Project match: No on Fig. 16), reprojection of input data will be requested.
After successful operation imported data layer should be automatically displayed in map window.
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 primitites (points, lines, boundaries, centroids, isles), see Fig. 19.
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.
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.
Work organization¶
GRASS GIS allows organizing work within one project (GRASS location) by creating different mapsets, see Unit 02. In the next units various analysis will be performed in “Oslo” region. Let’s create a new mapset called “oslo” for upcoming work.
Querying data¶
Imported raster or vector data layers can be iteractively queried by from Map Window toolbar.
Vector data layers (GRASS vector maps) can be queried also by attribute filters using Attribute Table Manager .
Vector features can be queried by simple SQL queries by WHERE statement.
Tip
GRASS offers also interactive tool for attribute querying similarly to other GIS packages. The tool accessible from Builder tab as SQL Builder.
Selected vector objects (commonly refered as “features” in GIS terminology) can be saved into new layer (GRASS vector map) from menu by
.Created vector map is automatically added into Layer Tree. Switch visibility of map layers by checkboxes and zoom to currently selected map (oslo) by as shown on Fig. 28.
Let’s change symbology of Oslo polygon vector map.
Feature outline and fill color can be changed in Colors tab.