15

Good news is that it's been fixed for QGIS 3.0.


14

If you are calculating a field of String type, this is the right syntax: CASE WHEN "VSt_K" = 'A' THEN '1' WHEN "VSt_K" = 'B' THEN '2' WHEN "VSt_K" = 'C' THEN '3' END Instead, if it's of Integer type: CASE WHEN "VSt_K" = 'A' THEN 1 WHEN "VSt_K" = 'B' THEN 2 WHEN "VSt_K" = 'C' THEN 3 END EDIT The syntax of the Advanced Python Field ...


13

Now you can access a model builder in QGIS from the: Processing menu -> Graphical modeler


12

The way I would set your task up would be to create a custom script which provides greater flexibility than the modeler but can still provide a similar interface to its users. You can create one from: Processing Toolbox > Scripts > Tools > Create new script Then copy/paste the script below and save it into C:/Users/You/.qgis2/processing/scripts. The ...


12

Very nice use case for yet another handy QGIS feature: Layer actions! Here the steps to configure your layer action: Open your layer Properties dialog. Click on menu Actions. Click on the green cross to add an action. Fill the dialog inputs as indicated in the following picture. You can Copy & Paste this couple of lines of code into the 'Action Text' ...


11

You can use expression within a model. For instance, my distance is in kilometers. But I want to do my buffer with meters. Next to the distance field in the buffer algorithm, you can choose an expression input. And then use the number input with a formula.


10

Create a new script from: Processing Toolbox > Scripts > Tools > Create new script Use something like the following: ##Example=name ##Layer=vector from qgis.core import QgsField from PyQt4.QtCore import QVariant layer = processing.getObject(Layer) idx = layer.fieldNameIndex('Source') if idx != -1: pass else: layer.startEditing() ...


9

This was intentionally disabled by commit 4f2a464 [processing] remove obsolete code and disable exporting models as script until we update it so support new scripts format @alexbruy alexbruy committed on 2 Feb So re-enabling it yourself won't be of any use as the output code won't be usable in QGIS 3x.


8

As mentioned in my comment, a custom script may be the way to go in this situation. You can create one from: Processing Toolbox > Scripts > Tools > Create new script The following script sets the input parameters as optional along with an if/else statement depending on which parameter contains a layer. So if a layer was selected for BGREN, it will ...


7

You can create a model from the Processing Toolbox which allows you to automate a number of tasks. You can create one by going to the menubar: Processing > Graphical Modeler... From the Inputs tab (shown in the red box), you will need two Vector layer parameters (shown in the blue box) for both your line and polygon layers. Then from the Algorithms ...


7

You would be better off using 'Select by expression' instead of 'Select by attribute'. Your expression should be something like - "AREA" = maximum( "AREA" ). (Replace AREA in the expression with the name of the column). For example, the following screenshot shows how to select the polygon with the maximum value of the POP_EST field using 'Select by ...


7

Create a New Model and add a Vector Layer Input. Restrict accepted geometries to Polygon. Add an Expression Input. The parent layer must be the vector layer input because the expression will be evaluated against that layer. Add an Extract by Expression algorithm. Select the vector layer and the expression from the model as inputs for the algorithm. ...


6

Instead of using the Field Calculator tool, a possible workaround is to create a custom script which allows the user to choose an attribute field and update it with a value they enter. To do this, go to Processing Toolbox > Scripts > Tools > Create new script and copy the following: ##Update field by number=name ##Layer=vector ##Fields=Field Layer ##Number=...


6

If you want to pass a path in your model to save your shapefiles into instead of doing it manually, a custom script is probably the way to go. You can write a script to run the Extract by location tool and define the path of the output. Something like this perhaps: ##Extract_by_location=name ##Layer=vector ##Additional_layer=vector layer = processing....


6

I think a custom script might be needed for this which allows you to set fixed layers and use these in your model without having to constantly specify them. You can create one from: Processing Toolbox > Scripts > Tools > Create new script And use something like the following: ##Example=name ##Listed_Building=output vector ##Building_Centre_Points=...


6

Just had a bit of a play with this. If you enter a decimal value for the default when setting up the parameter, you can use a decimal for the value when running the model.


6

A little dig in the processing algorithms and you can find: Split vector layer This algorithm takes a vector layer and an attribute and generates a set of vector layers in an output folder. Each of the layers created in that folder contains all features from the input layer with the same value for the specified attribute. The number of files generated is ...


6

According to https://github.com/qgis/QGIS/pull/2396 it should be possible to have optional parameters in models and scripts. The script case is covered by Make an optional input parameter in QGIS Processing Algorithm Script. In your case, the first alg you're trying to run is outputs_SAGACONVERTPOLYGONLINEVERTICESTOPOINTS_1=processing.runalg ('saga:...


6

You can use is_selected() function in if statement to perform calculation on just selected features.


6

Inside a model this requires a ; separated list field1;field2;field3


6

You should include your DEM as an input within that model. I have reproduce your model and just add that entry, and it worked. Here is the image of the model: Here is a final screenshot showing the result: Here you can get the model, the project and the layers I have used. Hope it works for you. Link to drive. By the way, I did this in QGIS 3.8


6

You can use Zonal Statistics tool.


5

I too have always wondered how to use the "File" parameter. Instead, remove the directory field and use the Vector layer as your input ("shp-File"): Save the model with your parameters for your field calculator. Then go back to the Processing Toolbox menu and right-click your model. There should be a "Execute as batch process" option: From the interface, ...


5

The Extract by attribute tool from the modeler accepts String inputs, not Number inputs. Here's a simple test which uses the following input parameters: Input - Table Field Layer - Vector layer Value - String (with default value of 80) Now when I run this, the default value will show up automatically: I have tested this on various field attributes (...


5

You could create a custom script in your model to clear the '/tmp' folder at the end of each run. There's numerous ways to delete files but I like to use shutil.rmtree which deletes all files/folders in a specified directory. To do this, go to Processing Toolbox > Scripts > Tools > Create new script and copy the following (adjust the path): import shutil ...


5

QGIS modeler treats any tool as intermediate which does not save any output, unless otherwise stated. To force the model to export a result, you have to input a layer output name in the Tool row. If I want to export the above result as a layer, I input a value in the output as so: What this does is add a dialoge box whenyou run the tool that you can set ...


5

I must admit I hadn't noticed that option before :) I'm not sure whether the current version of QGIS uses it for intermediate files, or just output files - it may use memory layers now. In either case, the principle is the same. As you say, geojson has an advantage over shapefile - there's no need to truncate ("launder") field names. The reason you ...


5

This is more of a workaround as I'm not sure if it's possible at the moment to allow a user to select from a range of string values. Instead, you could use booleans which would represent your formulae (these would be connected to a custom script which will contain your formulae). So that when a user clicks on a boolean from the modeler, the script will ...


5

You could use the Join attributes by location tool (which hopefully should in available in your modeler). If you select the Attribute summary option and choose Take summary of intersecting features, it will insert a Count field into your layer. If you don't want to calculate the sum, mean etc then just remove them so that the textbox is blank, that way you ...


5

Hit the ... button, set output file name and save like with usual saving single file. This create a basis for the files names. After hittingSave the Autofill settings should appear. There you can choose fill with values from any parameter or autofill by numbers, which creates suffix to your output name.


Only top voted, non community-wiki answers of a minimum length are eligible