5

Here's something me and my colleagues run into all the time: We're working in different QGIS files making maps visualizing our data. Every specific tool or action wants to save the output by default in the last used folder. Since we use a lot of tools once or twice during a single project, often this default folder is the folder of a different project, i.e. the last one in which we used the tool.

For instance:

  • I want to merge to vector layers using [Merge vector layer]
  • Instead of creating a temporary layer, I choose [save to file]
  • Qgis opens a browsing window, in the project folder where I last used this tool
  • I have to browse to my project home, and save
  • Next, I want to use [join attributes by nearest]
  • Again, QGIS opens the last used folder, and I have to browse to project home.
  • Repeat ad infinitum

Is there any way to set the default location to save the output of any tool to [Project Home], enabling my to browse from there?

1
  • I find this frustrating too
    – GlenS
    Commented Mar 28, 2023 at 9:52

1 Answer 1

3

Yes, I find this frustrating too. There is a code way to try and fix it which can be run at the python window or added as a macro - see instructions at this answer:

import os
from qgis.core import QgsProject
from PyQt5.QtCore import QSettings
prjhomepath = QgsProject.instance().homePath()
if os.path.exists(prjhomepath):
    QSettings().setValue('/UI/lastFileNameWidgetDir',prjhomepath)
    QSettings().setValue('/UI/lastRasterFileDir',prjhomepath)
    QSettings().setValue('/UI/lastVectorFileFilterDir',prjhomepath)
    QSettings().setValue('/Processing/LastInputPath',prjhomepath)
    QSettings().setValue('/Processing/LastOutputPath',prjhomepath)```

The code changes various folder locations stored in your QGIS.ini file to your projects home folder. There may be other folders to change - take a look at QGIS3.ini in a txt editor.

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.