g.gui.gmodeler(1grass)
β¨ g.gui.gmodeler β¨
okay bestie, so this is a page from the GRASS User's Manual β it's the manual for g.gui.gmodeler, and it's literally giving "I make your whole workflow cute and clickable" π
πΈ NAME πΈ
g.gui.gmodeler β the Graphical Modeler.
It lets you interactively create, edit, and manage models. no cap, that's the whole vibe π
π KEYWORDS π
general, GUI, graphical modeler, workflow
π¦ SYNOPSIS π¦
g.gui.gmodeler
g.gui.gmodeler --help
g.gui.gmodeler [file=name.gxm] [--help] [--verbose] [--quiet]
[--ui]
π© Flags:
--helpβ prints the usage summary, the lil "what do I even do" cheat sheet--verboseβ verbose module output, aka it tells you everything--quietβ quiet module output, aka shhh π€«--uiβ force launching the GUI dialog
π Parameters:
file=name.gxmβ Name of model file to be loaded
π DESCRIPTION π
The Graphical Modeler is a wxGUI component, and what it does is let you create, edit, and manage both simple and complex models through an interface that's actually easy to use β iconic behaviour honestly.
Here's the tea: when you're doing analytical operations in GRASS, those operations aren't just floating around by themselves, they're part of a chain of operations. With the Graphical Modeler, you can wrap a whole chain of processes (i.e. GRASS modules) into one single process (i.e. a model). And after that? Running the model later is sooo much easier, even when you're swapping in slightly different inputs or parameters. obsessed.
Models represent a programming technique used in GRASS to concatenate single steps together to accomplish a task. And the whole point is that it's way nicer when you see boxes and ovals connected by lines representing some tasks, instead of staring at lines of coded text. Like, visualise it, bestie. The Graphical Modeler can also be used as a custom tool that automates a process. Created models can simplify or shorten a task which can be run many times, and it can also be easily shared with others π«Ά
β οΈ Important to note is that models cannot perform specified tasks that one cannot also manually perform with GRASS. So like, no magic here, just organisation β¨
It is recommended to first develop the process manually, note down the steps (e.g. by using the Copy button in module dialogs), and later replicate them in the model. study first, then slay π
π The Graphical Modeler allows you to:
- define data items (raster, vector, 3D raster maps)
- define actions (GRASS commands)
- define relations between data and action items
- define loops (e.g. map series) and conditions (if-else statements)
- define model variables
- parameterize GRASS commands
- define intermediate data
- validate and run model
- save model properties to a file (GRASS Model File|
*.gxm) - export model to Python script
- export model to Python script in the form of a PyWPS process
- export model to an actinia process
- export model to image file
π§ Main dialog π§
You can launch the Graphical Modeler from the Layer Manager menu File -> Graphical modeler, or straight from the main toolbar. It's also available as a stand-alone module: g.gui.gmodeler. multiple doors, same slay πͺβ¨
The main Graphical Modeler menu contains options which enable the user to fully control the model. Directly under the main menu you'll find a toolbar with buttons (see figure below). There are options including:
- Create new model
- Load model from file
- Save current model to file
- Export model to image
- Export model to a (Python/PyWPS/actinia) script
- Add command (GRASS module) to model
- Add data to model
- Manually define relation between data and commands
- Add loop/series to model
- Add comment to model
- Redraw model canvas
- Validate model
- Run model
- Manage model variables
- Model settings
- Show manual
- Quit Graphical Modeler
Figure: Components of Graphical Modeler menu toolbar.
There's also a lower menu bar in the Graphical Modeler dialog where one can manage model items, visualize commands, add or manage model variables, define default values and descriptions. The Script editor dialog window allows seeing and exporting workflows as basic Python scripts, as PyWPS scripts, or as actinia processes. The rightmost tab of the bottom menu is automatically triggered when the model is activated, and it shows all the steps of running GRASS modeler modules β and in the case some errors occur in the calculation process, they are written at that place. so it's the drama tab, basically π
Figure: Lower Graphical Modeler menu toolbar.
π Components of models π
The workflow is usually established from four types of diagrams. Input and derived model data are usually represented with oval diagrams. This type of model element stores path to specific data on the user's disk. It is possible to insert vector data, raster data, database tables, etc. The type of data is clearly distinguishable in the model by its color. Different model elements are shown in the figures below.
- (A) raster data:
- (B) relation:
- (C) GRASS module:
- (D) loop:
- (E) database table:
- (F) 3D raster data:
- (G) vector data:
- (H) disabled GRASS module:
- (I) comment:
Figure: A model to perform unsupervised classification using MLC (i.maxlik) and SMAP (i.smap).
Another example:
Figure: A model to perform estimation of average annual soil loss caused by sheet and rill erosion using The Universal Soil Loss Equation.
Example as part of landslide prediction process:
Figure: A model to create parametric maps used by geologists to predict landslides in the area of interest.
π EXAMPLE π
ok so bestie, here's a whole real-life example and it ATE π
. In this one, the zipcodes_wake vector data and the elev_state_500m raster data from the North Carolina sample dataset (that's the original raster and vector data, icon behavior) get used to calculate average elevation for every single zone. And the important part of the whole process? The Graphical Modeler itself β specifically its powers of process automation β¨. That's the main character.
π« The workflow shown as a series of commands π«
In the command console, the procedure looks like this:
# input data import
r.import input=elev_state_500m.tif output=elevation
v.import input=zipcodes_wake.shp output=zipcodes_wake
# computation region settings
g.region vector=zipcodes_wake
# raster statistics (average values), upload to vector map table calculation
v.rast.stats -c map=zipcodes_wake raster=elevation column_prefix=rst method=average
# univariate statistics on selected table column for zipcode map calculation
v.db.univar map=zipcodes_wake column=rst_average
# conversion from vector to raster layer (due to result presentation)
v.to.rast input=zipcodes_wake output=zipcodes_avg use=attr attribute_column=rst_average
# display settings
r.colors -e map=zipcodes_avg color=bgyr
d.mon start=wx0 bgcolor=white
d.barscale style=arrow_ends color=black bgcolor=white fontsize=10
d.rast map=zipcodes_avg bgcolor=white
d.vect map=zipcodes_wake type=boundary color=black
d.northarrow style=1a at=85.0,15.0 color=black fill_color=black width=0 fontsize=10
d.legend raster=zipcodes_avg lines=50 thin=5 labelnum=5 color=black fontsize=10
π Defining the workflow in the Graphical Modeler π
To start performing the steps above as an automatic process with the Graphical Modeler, press the icon or type g.gui.gmodeler. The simplest way of inserting elements is by adding the complete GRASS command to the Command field in the GRASS command dialog (see the figure below π). With full text search you can do your module hunting way faster, lowkey genius. Next, the label and the command can be added. In case that only a module name is inserted, after pressing the Enter button the module dialog window is displayed and it is possible to set all of the usual module options (parameters and flags). Obsessed.
πΌοΈ Figure: Dialog for adding GRASS commands to model.
β¨ Managing model parameters β¨
All used modules can be parameterized in the model. That causes launching the dialog with input options for the model after the model is run. In this example, input layers (the zipcodes_wake vector map and the elev_state_500m raster map) are parameterized. Parameterized elements show their diagram border slightly thicker than those of unparameterized elements β it's giving β¨distinguishedβ¨.
πΌοΈ Figure: Model parameter settings.
The final model, the list of all model items, and the Script editor window with Save and Run option are shown in the figures below.
πΌοΈ Figure: A model to perform average statistics for zipcode zones.
πΌοΈ Figure: Items with Script editor window.
For convenience, this model for the Graphical Modeler is also available for download here. π«Ά
The model is run by clicking the Run button icon. When all inputs are set, the results can be displayed as shown in the next Figure:
πΌοΈ Figure: Average elevation for ZIP codes using North Carolina sample dataset as an automatic calculation performed by Graphical Modeler.
π₯ Managing model properties π₯
When the user wants to run the model again with the same data or the same names, it is necessary to use the --overwrite option. It will cause maps with identical names to be overwritten. Instead of setting it for every module separately, it is handy to change the Model Property settings globally. This dialog also includes metadata settings, where model name, model description and author(s) of the model can be specified. No cap, so much tidier.
πΌοΈ Figure: Model properties.
π¦ Defining variables π¦
Another useful trick is the possibility to set variables. Their content can be used as a substitute for other items. Value of variables can be values such as raster or vector data, integer, float, string value, or they may constitute some region, mapset, file or direction data type. Then it is not necessary to set any parameters for input data. The dialog with variable settings is automatically displayed after the model is run. So, instead of model parameters (e.g. r.import and v.import, see the Figure Run model dialog above) there are Variables.
πΌοΈ Figure: Model with variable inputs.
The key point is enclosing the substituting variable into %{...} and setting the value in the Variables dialog. For example, in the case of a model variable raster that points to an input file path and whose value is required to be used as one of the inputs for a particular model, it should be specified in the Variables dialog with its respective name (raster), data type, default value and description. Then it should be set in the module dialog as input called %{raster}.
πΌοΈ Figure: Example of raster file variable settings.
πΌοΈ Figure: Example of raster file variable usage.
π Saving the model file π
Finally, the model settings can be stored as a GRASS Model file with *.gxm extension. The advantage? It can be shared as a reusable workflow that may be run also by other users with different data. iykyk β¨
For example, this model can later be used to calculate the average precipitation for every administrative region in Slovakia using the precip raster data from the Slovakia precipitation dataset and administration boundaries of Slovakia from Slovak Geoportal (and literally only with a few clicks π
).
π§ Handling intermediate data π§
There can be some data in a model that did not exist before the process and that it is not worth it to maintain after the process executes. They can be described as being Intermediate by single clicking using the right mouse button, see the figure below. All such data should be deleted following model completion. The boundary of an intermediate component is a dotted line.
πΌοΈ Figure: Usage and definition of intermediate data in model.
π Using the Script editor π
By using the Script editor in the Graphical Modeler, the user can add Python code and then run it with the Run button or just save it as a Python script *.py. The result is shown in the Figure below:
πΌοΈ Figure: Script editor in the wxGUI Graphical Modeler.
The second option in the Script type combobox exports a PyWPS script instead of a basic Python one. A PyWPS process based on the model will be generated then; for the PyWPS script, the Run button is disabled as users are expected to include this script in their web processing service and not to run it on itself.
πΌοΈ Figure: Script editor in the wxGUI Graphical Modeler - set to PyWPS.
The third option in the Script type combobox exports an actinia process chain (non-parameterized model) or an actinia template (parameterized model). An actinia JSON based on the model will be generated then; as for the PyWPS script, the Run button is disabled as users are expected to include this JSON in their web processing service and not to run it on itself.
πΌοΈ Figure: Script editor in the wxGUI Graphical Modeler - set to actinia.
By default GRASS script package API is used (grass.script.core.run_command()). This can be changed in the settings. Alternatively also PyGRASS API is supported (grass.pygrass.modules.Module).
π Defining loops π
In the example below the MODIS MOD13Q1 (NDVI) satellite data products are used in a loop. The original data are stored as coded integer values that need to be multiplied by the value 0.0001 to represent real ndvi values. Moreover, GRASS provides a predefined color table called ndvi to represent ndvi data. In this case it is not necessary to work with every image separately. Periodt.
The Graphical Modeler is an appropriate tool to process data in an effective way using loop and variables (%{map} for a particular MODIS image in mapset and %{ndvi} for original data name suffix). After the loop component is added to the model, it is necessary to define a series of maps with required settings of map type, mapset, etc.
πΌοΈ Figure: MODIS data representation in GRASS after Graphical Modeler usage.
When the model is supplemented by all of modules, these modules should be ticked in the boxes of the loop dialog. The final model and its results are shown below.
πΌοΈ Figure: Model with loop.
πΌοΈ Figure: MODIS data representation in GRASS after Graphical Modeler usage.
The steps to enter in the command console of the Graphical Modeler would be as follows:
# note that the white space usage differs from the standard command line usage
# rename original image with preselected suffix
g.rename raster = %{map},%{map}.%{ndvi}
# convert integer values
r.mapcalc expression = %{map} = %{map}.%{ndvi} * 0.0001
# set color table appropriate for nvdi data
r.colors = map = %{map} color = ndvi
β οΈ heads up bestie: those spaces around the = signs are on purpose β the white space usage differs from the standard command line usage. don't "fix" it π
π SEE ALSO π
wxGUI,wxGUI components- See also selected user models available from GRASS Addons repository.
- See also the wiki page (especially various video tutorials).
π«Ά AUTHORS π«Ά
- Martin Landa, GeoForAll Lab, Czech Technical University in Prague, Czech Republic
- PyWPS support by Ondrej Pesek, GeoForAll Lab, Czech Technical University in Prague, Czech Republic
- Various manual improvements by Ludmila Furkevicova, Slovak University of Technology in Bratislava, Slovak Republic
β SOURCE CODE β
Available at: wxGUI Graphical Modeler source code (history)
Accessed: Tuesday Sep 08 11:56:22 2026
Main index | GUI index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole page, bestie β every last crumb of it πβ¨ this was g.gui.gmodeler(1grass) from the GRASS 8.5.0 Reference Manual, accessed Tuesday Sep 08 11:56:22 2026 π go build something iconic with it, ily, bye π
π
π¦ where this page comes from
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms