From a model, I would like to save processing results in a file. In my model I have some Extract by location algorithms (with two vector inputs) producing reasonable results but only as temporary layers, which I have to Save as... manually, which for a pile of analyses is bothering and time consuming.

Best, I would like to pass a path to my model, where my results are saved as shapefiles (in a first step).

This is the model. Note that the output vector (file) cannot connect to any of the processing results:

enter image description here

As can be seen in the screenshots a), we are able to pass a name for a final result, but not a file, even in the Save selected features algorithm b).

a) enter image description here

b) enter image description here

I have a vague idea how to achieve this with a python script, but can this be done with a combination of existing tools?

2 Answers 2


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:


layer = processing.getObject(Layer)
output_path = "C:/Users/You/Desktop/" + layer.name() + ".shp"

processing.runalg("qgis:extractbylocation", Layer, Additional_layer, u'contains', 0.00, output_path)

Replace the Extract by location tools in your model with this script and it will save the results to a shapefile in the path you specified.


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.

enter image description here

If I want to export the above result as a layer, I input a value in the output as so: enter image description here

What this does is add a dialoge box whenyou run the tool that you can set the output file:

enter image description here

The model itself shows the types of data with colors: purple for inputs, cyan for outputs

  • 1
    This is true indeed, but it is the same effort as leaving the output vectors as temporary files and then doing rightclick > Save As... for each of them. Commented Sep 20, 2016 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.