I am building an algorithm in the processing modeler which takes a csv file as input and creates a number of vector layers as output. I would like to automatically save these layers in the same folder as the project file. As I understand, it should be possible by entering the path "./filename.shp".

I can set the default save path for each layer in the final "Object Sink Parameter-definition" box in the modeler, but can't get this to work with a relative path.

When setting absolute path, everything works: C:/Users/Rasmus/Desktop/testfilQgis/målepunkter.shp

When setting only filename (felt.shp), the filename is added to the modelers default output directory path and saved to this path. When running the model on other computers, it will look for the local directory on my machine.

If I use a relative path (./koter.shp) that whole path will be added to the default output directory path (and break since the . folder doesn't exist).

Only the one folder up path seems to be accepted, but returns a "Failed to create: Permission denied".

See below image for the suggested save paths based on these inputs:

default save paths as suggested with above inputs

I've looked into using the project_folder as suggested here, but the "object sink parameter-definition" box only takes a path, so I'm not sure how to do that.

And setting the save path manually for each layer every time seems like defying the purpose of building a model. Surely, it must be possible to suggest a relative save path?

project > properties > save paths is set to relative (default).

Thanks in advance!

  • 1
    I think I have a similar problem. How did you solve your problem? With the solution from @Sanch? - Are there an easy solution? I use 3.10.14.
    – juko
    Commented Mar 22, 2021 at 16:32
  • Edit: The solution from @Sanch works for me too!
    – juko
    Commented Mar 23, 2021 at 9:12

2 Answers 2


First, create the entire process within the modeler, and include the input "File/Folder". Image1

Then open it with the inbuilt Python editor in QGIS, then edit any code with the file path to the name of the input.

In my example, I have defined the folder as "folderlocation", given it a path. This is the only place you will need to change the folder path each time.Image2

You can see the output points to the folder location in the second red box.


building on Sanch's answer: Another (possible new) option is to also add the "set project variable" algorithm in the graphical model (together with the "file/folder" input). Give the variable a name and set the value to the "file/folder" model input. For your models output select pre-calculated value and enter @variable_name '||' filename.gpkg. Only downside to this approach is that the created files aren't automatically added to your QGIS project.

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.