25.1.6. Modeler tools

These tools are only available in the Graphical Modeler. They are not available in the Processing Toolbox.

25.1.6.1. Conditional branch

Adds a conditional branch into a model, allowing parts of the model to be executed based on the result of an expression evaluation. Mostly by using tool dependencies to control the flow of a model.

25.1.6.1.1. Parameters

Label

Name

Type

Description

Field

BRANCH

[string]

Name of the condition

Field

CONDITION

[expression]

Expression to evaluate

25.1.6.1.2. Outputs

None.

25.1.6.1.3. Python code

Algorithm ID: native:condition

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.2. Create directory

Creates a new directory on a file system. Directories will be created recursively, creating all required parent directories in order to construct the full specified directory path. No errors will be raised if the directory already exists.

25.1.6.2.1. Parameters

Label

Name

Type

Description

Directory path

PATH

[string]

Folder path to create

25.1.6.2.2. Outputs

Label

Name

Type

Description

Output

OUTPUT

[folder]

Created folder

25.1.6.2.3. Python code

Algorithm ID: native:createdirectory

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.3. Feature filter

Filters features from the input layer and redirects them to one or several outputs. If you do not know about any attribute names that are common to all possible input layers, filtering is only possible on the feature geometry and general record mechanisms, such as $id and uuid.

25.1.6.3.1. Parameters

Label

Name

Type

Description

Input layer

INPUT

[vector: any]

The input layer.

Outputs and filters

(one or more)

OUTPUT_<name of the filter>

[same as input]

The output layers with filters (as many as there are filters).

25.1.6.3.2. Outputs

Label

Name

Type

Description

Output

(one or more)

native:filter_1:OUTPUT_<name of filter>

[same as input]

The output layers with filtered features (as many as there are filters).

25.1.6.3.3. Python code

Algorithm ID: native:filter

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.4. Filter by geometry type

Filters features by their geometry type. Incoming features will be directed to different outputs based on whether they have a point, line or polygon geometry.

25.1.6.4.1. Parameters

Label

Name

Type

Description

Input layer

INPUT

[vector: any]

Layer to evaluate

25.1.6.4.2. Outputs

Label

Name

Type

Description

Point features

Optional

POINTS

[vector: point]

Layer with points

Line features

Optional

LINES

[vector: line]

Layer with lines

Polygon features

Optional

POLYGONS

[vector: polygon]

Layer with polygons

Features with no geometry

Optional

NO_GEOMETRY

[table]

Geometry-less vector layer

25.1.6.4.3. Python code

Algorithm ID: native:filterbygeometry

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.5. Filter layers by type

Filters layers by their type. Incoming layers will be directed to different outputs based on whether they are a vector or raster layer.

25.1.6.5.1. Parameters

Label

Name

Type

Description

Input layer

INPUT

[layer]

Generic Map Layer

25.1.6.5.2. Outputs

Label

Name

Type

Description

Vector features

Optional

VECTOR

[vector]

A Vector Layer of the input, if compatible

Raster layer

Optional

RASTER

[raster]

A Raster Layer of the input, if compatible

25.1.6.5.3. Python code

Algorithm ID: native:filterlayersbytype

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.6. Load layer into project

Loads a layer to the current project.

25.1.6.6.1. Parameters

Label

Name

Type

Description

Layer

INPUT

[layer]

Layer to load in the legend

Loaded layer name

NAME

[string]

Name of the loaded layer

25.1.6.6.2. Outputs

Label

Name

Type

Description

Layer

OUTPUT

[same as input]

The (renamed) loaded layer

25.1.6.6.3. Python code

Algorithm ID: native:loadlayer

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.7. Raise exception

Raises an exception and cancels a model’s execution. The exception message can be customized, and optionally an expression based condition can be specified. If an expression condition is used, then the exception will only be raised if the expression result is true. A false result indicates that no exception will be raised, and the model execution can continue uninterrupted.

25.1.6.7.1. Parameters

Label

Name

Type

Description

Message

MESSAGE

[string]

Message to display

Condition

CONDITION

[expression]

Expression to evaluate if true

25.1.6.7.2. Outputs

None.

25.1.6.7.3. Python code

Algorithm ID: native:raiseexception

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.8. Raise warning

Raises a warning message in the log. The warning message can be customized, and optionally an expression based condition can be specified. If an expression condition is used, then the warning will only be logged if the expression result is true. A false result indicates that no warning will be logged.

25.1.6.8.1. Parameters

Label

Name

Type

Description

Message

MESSAGE

[string]

Message to display

Condition

CONDITION

[expression]

Expression to evaluate if true

25.1.6.8.2. Outputs

None.

25.1.6.8.3. Python code

Algorithm ID: native:raisewarning

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.9. Rename layer

Renames a layer.

25.1.6.9.1. Parameters

Label

Name

Type

Description

Layer

INPUT

[layer]

Layer to rename

New name

NAME

[string]

The new name of the layer

25.1.6.9.2. Outputs

Label

Name

Type

Description

Layer

OUTPUT

[same as input]

The (renamed) output layer

25.1.6.9.3. Python code

Algorithm ID: native:renamelayer

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.10. Save log to file

Saves the model’s execution log to a file. Optionally, the log can be saved in a HTML formatted version.

25.1.6.10.1. Parameters

Label

Name

Type

Description

Use HTML

USE_HTML

[Boolean]

Default: False

Use HTML formatting

25.1.6.10.2. Outputs

Label

Name

Type

Description

File

OUTPUT

[string]

Destination of the log

25.1.6.10.3. Python code

Algorithm ID: native:savelog

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.11. Set project variable

Sets an expression variable for the current project.

25.1.6.11.1. Parameters

Label

Name

Type

Description

Variable name

NAME

[string]

Name of the variable

Variable value

VALUE

[string]

Value to be stored

25.1.6.11.2. Outputs

None.

25.1.6.11.3. Python code

Algorithm ID: native:setprojectvariable

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.12. String concatenation

Concatenates two strings into a single one in the Processing Modeler.

25.1.6.12.1. Parameters

Label

Name

Type

Description

Input 1

INPUT_1

[string]

First string

Input 2

INPUT_2

[string]

Second string

25.1.6.12.2. Outputs

Label

Name

Type

Description

Concatenation

CONCATENATION

[string]

The concatenated string

25.1.6.12.3. Python code

Algorithm ID: native:stringconcatenation

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.

25.1.6.13. Variable distance buffer

Computes a buffer area for all the features in an input layer.

The size of the buffer for a given feature is defined by an attribute, so it allows different features to have different buffer sizes.

See also

Buffer

25.1.6.13.1. Parameters

Label

Name

Type

Description

Input layer

INPUT

[vector: any]

Input vector layer

Distance field

DISTANCE

[tablefield: numeric]

Attribute for the distance radius of the buffer

Segments

SEGMENTS

[number]

Default: 5

Controls the number of line segments to use to approximate a quarter circle when creating rounded offsets.

Dissolve result

DISSOLVE

[boolean]

Default: False

Choose to dissolve the final buffer, resulting in a single feature covering all input features.

../../../../_images/buffer_dissolve1.png

Fig. 25.8 Normal and dissolved buffer

End cap style

END_CAP_STYLE

[enumeration]

Default: Round

Controls how line endings are handled in the buffer.

../../../../_images/buffer_cap_style.png

Fig. 25.9 Round, flat and square cap styles

Join style

JOIN_STYLE

[enumeration]

Default: Round

Specifies whether round, miter or beveled joins should be used when offsetting corners in a line.

Miter limit

MITER_LIMIT

[number]

Default: 2.0

Only applicable for mitered join styles, and controls the maximum distance from the offset curve to use when creating a mitered join.

25.1.6.13.2. Outputs

Label

Name

Type

Description

Buffer

OUTPUT

[vector: polygon]

Buffer polygon vector layer.

25.1.6.13.3. Python code

Algorithm ID: qgis:variabledistancebuffer

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.