Background: We're doing a lot of project work using QGIS. These projects are based on "template"-projects for administrative units, which are always kept up to date, e.g. new WMS are added, newly downloaded data, etc. Once a project is created, we save the corresponding template to the project folder and usually add some project-specific layers. These layers are not relevant to all the other projects, hence the "separation" in order to keep the template as sleek as possible.

Problem: Sometimes datasources change. WMS get turned off, or new data becomes available, etc, pp. These changes are incorporated into the templates by us, naturally. But the already created projects also need to be updated - which can be labourous, especially if there are 50 or more projects within an administrative unit.

Question: Is there a possibility to automatically update the layers/links in these projects? Either by using the templates as reference, or by incorporating a database, or by some other means?

  • 2
    Would you be able and willing to completely move to RDB (i.e. PostgreSQL/PostGIS)? Simply stated, since a project stores reference only (no data) to the database relations, changes made to them will be reflected immediately and without changing the project definitions. As for the WMS services; keeping their URLs in a table as well and have a script read them out and adding them when the project loads comes to mind.
    – geozelot
    Dec 20, 2019 at 12:04
  • @ThingumaBob changing the background process of project creation/updating would be possible, I guess. The "front end" - how users open the projects and work with them - shouldn't change, I had enough hassle convincing people to use QGIS in the first place. Can you provide a link where the procedure you describe for the WMS is explained exemplary?
    – Erik
    Dec 20, 2019 at 12:25
  • 1
    Well, to be honest, changing from file based to RDB storage is rather involved - once; you'd need to setup all necessary relations (tables) and import your data, alter all your projects to point to the DB data sources and likely setup DB logic. However, from that point onwards you'd manage and update all base data in the DB, and changes to it are immediately present in your users projects. For them, nothing changes (except the source of data to be added). Someone needs some expertise with all this, though... As for the WMS part: the source of that is mainly my head, I was brainstorming
    – geozelot
    Dec 20, 2019 at 12:41
  • 1
    QGIS project files are just text, so you can update one by a simple search-and-replace. Doing that manually for each project would be a bit faster than manually updating the links in QGIS. But the real advantage is that you could write a script to update the project files, with the script input being the new and old data source paths.
    – csk
    Dec 20, 2019 at 19:12

1 Answer 1


So, currently we've updated our process to exporting layer definition files which contain all relevant new layers and then get added (via the browser) to outdated projects. Though still manual work, this saves a lot of time, especially since the saved layers already have the correct styling, name & visibility.

Also, this process feels better controllable than search & replace through a text editor, where mistake are made more easily.

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.