Graphical Modeler

Graphic Modeler (g.gui.gmodeler) allows the user to create, edit, and manage complex models using easy-to-use interface. Using Graphical Modeler, that chain of processes (ie. GRASS modules) can be wrapped into one process (ie. model). So it’s easier to execute the model later with slightly different inputs or parameters.

Flooding Model Example

In our example will be created a model to simulate flooding using r.lake (see Lesson 2). The model will also print flooded area in hectares (r.report) and output a new vector map containing flooded roads (v.overlay). This step requires to create vector map of flooded area using r.recode and r.to.vect. The length of flooded roads can be printed using v.to.db.

Version 1

../_images/model-lake1.png

Fig. 49 First version of the flooding model.

../_images/model-lake1-output.png

Fig. 50 Example of output (water level: 990).

Model to download: lake1.gxm

Version 2

Our model uses hardcoded values. In the second version we will show how to parametrize water_level option.

../_images/model-lake2-params.png

Fig. 51 Module options can be parametrized directly in GUI dialogs.

The modified model will ask user before launching for parametrized options, in our case for water_level, see figure below.

../_images/model-lake2-run.png

Fig. 52 Dialog of parametrized options.

For example increasing water level from 990 to 995 leads to flooded area 1.43 ha and road length 169 m.

Model to download: lake2.gxm

Version 3

The model overwrites output data. We will modify the model to create output raster lake map and clipped roads map for each value separately. Eg. for water level 990 will create modified model lake_990 and roads_lake_990 maps, for level 995 lake_995 and roads_lake_995, etc. This modification will be implemented in the modeler using variables. Firstly we disable parametrization of water_level and then we will add a new variable water_level, see figure below.

../_images/model-lake3-variable.png

Fig. 53 Adding new variable to the model.

Afterwards we must modify all modules which should use this variable. In our case:

../_images/model-lake3-mod1.png

Fig. 54 Modification of lake option (r.lake).

../_images/model-lake3-mod2.png

Fig. 55 Modification of expression option (r.mapcalc).

Model to download: lake3.gxm

../_images/lake_990_995.png

Fig. 56 Comparision of water levels 990 and 995 (performed by g.gui.mapswipe).