15

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 ...


15

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


14

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' ...


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 ...


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 ...


8

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


8

Yes, you can use "select by expression" tool and insert if(is_selected() is false,true,false) as expression. This will allow inverting your selection in graphical modeler. Result:


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

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 ...


7

This workflow needs the csv-layer added into the layer panel before. QGIS 2.18 Workflow from Inputs you add a Table (Picture Nr 1. - 2.) add "Points layer from table" (Nr. 4) 2a. define x and y fields 2b. define output-file save and run model (Nr.5) The steps aren't simliar with the screenshot, but the order in general is the same. QGIS 3.2.1 Workflow ...


7

Inside a model fieldnames without any quotes separated by semicolon: field1;field2;field3


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. ...


7

Yes, thats basically some simple stuff that has changed in 3.14. You are doing it correctly for older versions. Since 3.14 you first need to click on the "123" field just on the left and select "model input". Then you can choose your Model-Input-Layer from the dropdown menu.


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

I fear there is no simple way to convert geoprocessing models from QGIS 2 to 3. Simply converting it from json to xml can be done with services like http://www.utilities-online.info/xmltojson/ but the structure of the result is completely different between the two versions: Converted from QGIS 2 model json (example): <?xml version="1.0" encoding="UTF-8" ...


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

Add vector layer parameter Use this parameter as input for algorithm Run the model - it will ask you to select a file for the vector layer parameter


6

You need to separate them via semi-colons: field1;field2;field3


6

You can use the help text editor (button next to green "play" button) to edit informational metadata with your model:


6

SAGA For the SAGA raster calculator, you can set the Formula option to read the value from your Number Input parameter: In the Formula option, set the drop-down menu to Pre-calculated Value. The first layer is defined by the string 'a'. So if you want to take the original values from the first raster layer and add the value from the Number Input parameter, ...


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.


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