mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
350 lines
20 KiB
HTML
350 lines
20 KiB
HTML
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>The SEXTANTE graphical modeler — SEXTANTE for QGIS 1.0 documentation</title>
|
|
|
|
<link rel="stylesheet" href="_static/default.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: '',
|
|
VERSION: '1.0',
|
|
COLLAPSE_INDEX: false,
|
|
FILE_SUFFIX: '.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
<link rel="top" title="SEXTANTE for QGIS 1.0 documentation" href="index.html" />
|
|
<link rel="next" title="The SEXTANTE batch processing interface" href="batch.html" />
|
|
<link rel="prev" title="The SEXTANTE toolbox" href="toolbox.html" />
|
|
</head>
|
|
<body>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="genindex.html" title="General Index"
|
|
accesskey="I">index</a></li>
|
|
<li class="right" >
|
|
<a href="batch.html" title="The SEXTANTE batch processing interface"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="toolbox.html" title="The SEXTANTE toolbox"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="index.html">SEXTANTE for QGIS 1.0 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="the-sextante-graphical-modeler">
|
|
<h1>The SEXTANTE graphical modeler<a class="headerlink" href="#the-sextante-graphical-modeler" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="introduction">
|
|
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
|
|
<p>The <em>graphical modeler</em> allows to create complex models using a simple
|
|
and easy-to-use interface. When working with a GIS, most analysis
|
|
operations are not isolated, but part of a chain of operations instead.
|
|
Using the graphical modeler, that chain of processes can be wrapped into
|
|
a single process, so it is easier and more convenient to execute than a
|
|
single process later on a different set on inputs. No matter how many
|
|
steps and different algorithms it involves, a model is executed as a
|
|
single algorithm, thus saving time and effort, specially for larger
|
|
models.</p>
|
|
<p>The modeler can be opened from the SEXTANTE menu, but also from the
|
|
toolbox. In the <em>Modeler</em> branch of the algorithms tree you will find a
|
|
group named <em>Tools</em>, which contains an entry called <em>Create new model</em></p>
|
|
<p>The modeler has a working canvas where the structure of the model and
|
|
the workflow it represents are shown. On the left part of the window, a
|
|
panel with two tabs can be used to add new elements to the model.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/modeler_canvas.png" />
|
|
</div>
|
|
<p>Creating a model involves two steps:</p>
|
|
<ul class="simple">
|
|
<li><em>Definition of necessary inputs</em>. These inputs will be added to the
|
|
parameters window, so the user can set their values when executing
|
|
the model. The model itself is a SEXTANTE algorithm, so the
|
|
parameters window is generated automatically as it happens with all
|
|
the algorithms included in SEXTANTE.</li>
|
|
<li><em>Definition of the workflow</em>. Using the input data of the model, the
|
|
workflow is defined adding algorithms and selecting how they use
|
|
those inputs or the outputs generated by other algorithms already in
|
|
the model</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="definition-of-inputs">
|
|
<h2>Definition of inputs<a class="headerlink" href="#definition-of-inputs" title="Permalink to this headline">¶</a></h2>
|
|
<p>The first step to create a model is to define the inputs it needs. The
|
|
following elements are found in the <em>Inputs</em> tabs on the left side of
|
|
the modeler window:</p>
|
|
<ul class="simple">
|
|
<li>Raster layer</li>
|
|
<li>Vector layer</li>
|
|
<li>String</li>
|
|
<li>Table field</li>
|
|
<li>Table</li>
|
|
<li>Numerical value</li>
|
|
<li>Boolean value</li>
|
|
</ul>
|
|
<p>Double-clicking on any of them, a dialog is shown to define its
|
|
caracteristics. Depending on the parameter itself, the dialog will
|
|
contain just one basic element (the description, which is what the user
|
|
will see when executing the model) or more of them. For instance, when
|
|
adding a numerical value, as it can be seen in the next figure, apart
|
|
from the description of the parameter you have to set a default value
|
|
and a range of valid values.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/models_parameters.png" />
|
|
</div>
|
|
<p>For each added input, a new element is added to the modeler canvas.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/models_parameters2.png" />
|
|
</div>
|
|
</div>
|
|
<div class="section" id="definition-of-the-workflow">
|
|
<h2>Definition of the workflow<a class="headerlink" href="#definition-of-the-workflow" title="Permalink to this headline">¶</a></h2>
|
|
<p>Once the inputs have been defined, it is time to define the algorithms
|
|
to apply on them. Algorithms can be found in the <em>Algorithms</em> tab,
|
|
grouped much in the same way as they are in the toolbox.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/models_parameters3.png" />
|
|
</div>
|
|
<p>To add an algorithm, double-click on its name. An execution dialog will
|
|
appear, with a content similar to the one found in the execution panel
|
|
that SEXTANTE shows when executing the algorithm from the toolbox. the
|
|
one shown next correspond to the SAGA convergence index algorithm, the
|
|
same one we saw in the section dedicated to the SEXTANTe toolbox.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/models_parameters4.png" />
|
|
</div>
|
|
<p>As you can see, some differences exist. Instead of the file output box
|
|
that was used to set the filepath for output layers and tables, a simple
|
|
text box is. If the layer generated by the algorithm is just a temporary
|
|
result that will be used as the input of another algorithm and should
|
|
not be kept as a final result, just do not edit that textbox. Typing
|
|
anything on it means that the result is a final one, and the text that
|
|
you supply will be the description for the output, which will be the one
|
|
the user will see when executing the model.</p>
|
|
<p>Selecting the value of each parameter is also a bit different, since
|
|
there are importante differences between the context of the modeler and
|
|
the toolbox one. Let’s see how to introduce the values for each type of
|
|
parameter.</p>
|
|
<ul class="simple">
|
|
<li>Layers (raster and vector) and tables. They are selected from a
|
|
list, but in this case the possible values are not the layers or
|
|
tables currently loaded in QGIS, but the list of model inputs of the
|
|
corresponding type, or other layers or tables generated by algorithms
|
|
already added to the model.</li>
|
|
<li>Numerical values. Literal values can be introduced directly on the
|
|
textbox. But this textbox is also a list that can be used to select
|
|
any of the numerical value inputs of the model. In this case, the
|
|
parameter will take the value introduced by the user when executing
|
|
the model.</li>
|
|
<li>String. Like in the case of numerical values, literal strings can be
|
|
typed, or an input string can be selected.</li>
|
|
<li>Table field. The fields of the parent table or layer cannot be known
|
|
at design-time, since they depend of the selection of the user each
|
|
time the model is executed. To set the value for this parameter, type
|
|
the name of a field directly in the textbox, or use the list to
|
|
select a table field input already added to the model. The validity
|
|
of the selected field will be checked by SEXTANTE at run-time</li>
|
|
</ul>
|
|
<p>Once all the parameter have been assigned valid values, click on <em>OK</em>
|
|
and the algorithm will be added to the canvas. It will be linked to all
|
|
the other elements in the canvas, whether algorithms or inputs, which
|
|
provide objects that are used as inputs for that algorithm.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/models_parameters5.png" />
|
|
</div>
|
|
<p>Elements can be dragged to a different position within the canvas, to
|
|
change the way the module structure is displayed and make it more clear
|
|
and intuitive. Links between elements are update automatically.</p>
|
|
<p>You can run your algorithm anytime clicking on the <em>Run</em> button. However, in order to use it from the toolbox, it has to be saved and the modeler dialog closed, to allow the toolbox to refresh its contents.</p>
|
|
</div>
|
|
<div class="section" id="saving-and-loading-models">
|
|
<h2>Saving and loading models<a class="headerlink" href="#saving-and-loading-models" title="Permalink to this headline">¶</a></h2>
|
|
<p>Use the <em>Save</em> button to save the current model and the <em>Open</em> one to
|
|
open any model previously saved. Model are saved with the <tt class="docutils literal"><span class="pre">.model</span></tt>
|
|
extension. If the model has been previously saved from the modeler
|
|
window, you will not be prompted for a filename, since there is already
|
|
a file associated with that model, and it will be used.</p>
|
|
<p>Before saving a model, you have to enter a name and a group for it,
|
|
using the text boxes in the upper part of the window.</p>
|
|
<p>Models saved on the models folder (the default folder when you are
|
|
prompted for a filename to save the model) will appear in the toolbox in
|
|
the corresponding branch. When the toolbox is invoked, SEXTANTE searches
|
|
the models folder for files with <tt class="docutils literal"><span class="pre">.model</span></tt> extension and loads the
|
|
models they contain. Since a model is itself a SEXTANTE algorithm, it
|
|
can be added to the toolbox just like any other algorithm.</p>
|
|
<p>The models folder can be set from the SEXTANTE configuration dialog,
|
|
under the <em>Modeler</em> group.</p>
|
|
<p>Models loaded from the models folder appear not only in the toolbox, but
|
|
also in the algorithms tree in the <em>Algorithms</em> tab of the modeler
|
|
window. That means that you can incorporate a model as a part of a
|
|
bigger model, just as you add any other algorithm.</p>
|
|
<p>In some cases, SEXTANTE might not be able to load a model because it
|
|
cannot find all the algorithms included in its workflow. If you have
|
|
used a given algorithm as part of your model, it should be available
|
|
(that is, it should appear on the toolbox) in order to load that model.
|
|
Deactivating an algorithm provider in the SEXTANTE configuration window
|
|
renders all the algorithms in that provider unusable by the modeler,
|
|
which might cause problems when loading models. Keep that in mind when
|
|
you have trouble loading or executing models.</p>
|
|
</div>
|
|
<div class="section" id="editing-a-model">
|
|
<h2>Editing a model<a class="headerlink" href="#editing-a-model" title="Permalink to this headline">¶</a></h2>
|
|
<p>You can edit the model you are currently creating, redefining the workflow and the relationships between the algorithms and inputs that define the model itself.</p>
|
|
<p>If you right-click on an algorithm in the canvas representing the model, you will see a context menu like the one shown next:</p>
|
|
<div class="figure align-center">
|
|
<img alt="_images/modeler_right_click.png" src="_images/modeler_right_click.png" />
|
|
</div>
|
|
<p>Selecting the <em>Remove</em> option will cause the selected algorithm to be removed. An algorithm can be removed only if there are no other algorithms dependind on it. That is, if no output from the algorithm is used in a different one as input. If you try to remove an algorithm that has others depending on it, SEXTANTE will show you a warning message like the one you can see below:</p>
|
|
<div class="figure align-center">
|
|
<img alt="_images/cannot_delete_alg.png" src="_images/cannot_delete_alg.png" />
|
|
</div>
|
|
<p>Selecting the <em>Edit</em> option or simply double-clicking on the algorithm icon will show the parameters dialog of the algorithm, so you can change the inputs and parameter values. Not all input elements available in the model will appear in this case as available inputs. Layers or values generated at a more advanced step in the workflow defined by the model will not be available if they cause circular dependencies.</p>
|
|
<p>Select the new values and then click on the <em>OK</em> button as usual. The connections between the model elements will change accordingly in the modeler canvas.</p>
|
|
</div>
|
|
<div class="section" id="activating-and-deactivating-algorithms">
|
|
<h2>Activating and deactivating algorithms<a class="headerlink" href="#activating-and-deactivating-algorithms" title="Permalink to this headline">¶</a></h2>
|
|
<p>Algorithms can be deactivated in the modeler, so they will not be executed once the model is run. This can be used to test just a given part of the model, or when you do not need all the outputs it generates.</p>
|
|
<p>To deactivate an algorithm, right–click on its icon in the model canvas and select the <em>Deactivate</em> option. You will see that the algorithm is represented now with a red label under its name indicating that is not active.</p>
|
|
<div class="figure align-center">
|
|
<img alt="_images/deactivated.png" src="_images/deactivated.png" />
|
|
</div>
|
|
<p>All algorithms depending (directly or undirectly) on that algorithm will also appear as inactive, since they cannot be executed now.</p>
|
|
<p>To activate an algorithm, just right–click on its icon and select the <em>Activate</em> option.</p>
|
|
</div>
|
|
<div class="section" id="editing-model-help-files-and-meta-information">
|
|
<h2>Editing model help files and meta-information<a class="headerlink" href="#editing-model-help-files-and-meta-information" title="Permalink to this headline">¶</a></h2>
|
|
<p>You can document your models from SEXTANTE. Just click on the <em>Edit model help</em> button and a dialog like the one shown next will appear.</p>
|
|
<div class="figure align-center">
|
|
<img alt="image" src="_images/help_edition.png" />
|
|
</div>
|
|
<p>On the right-hand side you will see a simple HTML page, created using the description of the input parameters and outputs of the algorithm, along with some additional items like a general description of the model or its author. The first time you open the help editor all those descriptions are empty, but you can edit them using the elements on the left-hand side of the dialog. Select an element on the upper part and the write its description in the texbox below.</p>
|
|
<p>Model help is saved in a file in the same folder as the model itself. You do not have to worry about saving it, since it is done automatically.</p>
|
|
</div>
|
|
<div class="section" id="about-available-algorithms">
|
|
<h2>About available algorithms<a class="headerlink" href="#about-available-algorithms" title="Permalink to this headline">¶</a></h2>
|
|
<p>You might notice that some algorithms that can be be executed from the
|
|
toolbox do not appear in the list of available ones when you are
|
|
designing a model. To be included in a model, and algorithm must have a
|
|
correct semantic, so as to be properly linked to other in the workflow.
|
|
If an algorithm does not have such well-defined semantic (for instance,
|
|
if the number of output layers cannot be know in advance), then it is
|
|
not possible to use it within a model, and thus does not appear in the
|
|
list of them that you can find in the modeler dialog.</p>
|
|
<p>Additionally, you will see some algorithms in the modeler that are not
|
|
found in the toolbox. This algorithms are meant to be used exclusively
|
|
as part of a model, and they are of no interest in a different context.
|
|
The <em>Calculator</em> algorithm is an example of that. It is just a simple
|
|
arithmetic calculator that you can use to modify numerical values
|
|
(entered by the user or generated by some other algorithm). This tools
|
|
is really useful within a model, but outside of that context, it doesn’t
|
|
make too much sense.</p>
|
|
</div>
|
|
<div class="section" id="sextante-models-as-python-code">
|
|
<h2>SEXTANTE models as Python code<a class="headerlink" href="#sextante-models-as-python-code" title="Permalink to this headline">¶</a></h2>
|
|
<p><em>[This feature is temporarily unavailable]</em></p>
|
|
<p>Along with the tab that contains the graphical design of the model, you
|
|
will find another one containing a Python script which performs the same
|
|
task as the model itself. Using that code, you can create a console
|
|
script (we will explain them later in this same manual) and modify it to
|
|
incorporate actions and methods not available in the graphical modeler,
|
|
such as loops or conditional sentences.</p>
|
|
<p>This feature is also a very practical way of learning how to use
|
|
SEXTANTE from the console and how to create SEXTANTE algorithms using
|
|
Python code, so you can use it as a learning tool when you start
|
|
creating your own SEXTANTE scripts.</p>
|
|
<p>You will find a button below the text field containing the Python code.
|
|
Click on it to directly create a new script from that code, without
|
|
having to copy and paste it in the SEXTANTE script editor.</p>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sphinxsidebar">
|
|
<div class="sphinxsidebarwrapper">
|
|
<h3><a href="index.html">Table Of Contents</a></h3>
|
|
<ul>
|
|
<li><a class="reference internal" href="#">The SEXTANTE graphical modeler</a><ul>
|
|
<li><a class="reference internal" href="#introduction">Introduction</a></li>
|
|
<li><a class="reference internal" href="#definition-of-inputs">Definition of inputs</a></li>
|
|
<li><a class="reference internal" href="#definition-of-the-workflow">Definition of the workflow</a></li>
|
|
<li><a class="reference internal" href="#saving-and-loading-models">Saving and loading models</a></li>
|
|
<li><a class="reference internal" href="#editing-a-model">Editing a model</a></li>
|
|
<li><a class="reference internal" href="#activating-and-deactivating-algorithms">Activating and deactivating algorithms</a></li>
|
|
<li><a class="reference internal" href="#editing-model-help-files-and-meta-information">Editing model help files and meta-information</a></li>
|
|
<li><a class="reference internal" href="#about-available-algorithms">About available algorithms</a></li>
|
|
<li><a class="reference internal" href="#sextante-models-as-python-code">SEXTANTE models as Python code</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="toolbox.html"
|
|
title="previous chapter">The SEXTANTE toolbox</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="batch.html"
|
|
title="next chapter">The SEXTANTE batch processing interface</a></p>
|
|
<h3>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="_sources/modeler.txt"
|
|
rel="nofollow">Show Source</a></li>
|
|
</ul>
|
|
<div id="searchbox" style="display: none">
|
|
<h3>Quick search</h3>
|
|
<form class="search" action="search.html" method="get">
|
|
<input type="text" name="q" />
|
|
<input type="submit" value="Go" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
<p class="searchtip" style="font-size: 90%">
|
|
Enter search terms or a module, class or function name.
|
|
</p>
|
|
</div>
|
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="genindex.html" title="General Index"
|
|
>index</a></li>
|
|
<li class="right" >
|
|
<a href="batch.html" title="The SEXTANTE batch processing interface"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="toolbox.html" title="The SEXTANTE toolbox"
|
|
>previous</a> |</li>
|
|
<li><a href="index.html">SEXTANTE for QGIS 1.0 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© Copyright 2012, Victor Olaya.
|
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
|
</div>
|
|
</body>
|
|
</html>
|