TransWikia.com

Automatically exchange QGIS layer datasources during project opening?

Geographic Information Systems Asked on January 31, 2021

Do you know of any existing QGIS plugin that automatically exchanges layer datasources during opening of a Project?

I would like to transparently switch our users from “PostGIS A” server to “PostGIS B” using a predefined datasource mapping.

We are on QGIS 2.18 for Windows

Using a script is not an option for us. I like more the idea of hooking into the project open event/signal and change the datasource there.

One Answer

In my desperate aim to solve this problem, I managed to transparently replace vector and raster datasources during project opening.

But unfortunately, this only works as long as the old datasources are still available. If QGIS discovers a broken datasource, the internal bad layer handler is called, showing the default repair dialog.

The "changeDataSource" plugin therefor uses a custom BadLayerHandler, but I really would like to keep the default dialog for all the other datasources which should be manually repaired. I'm searching for a mechanism to replace the internal project XML (QDomDocument) during project opening, so that the default bad layer handling is still available. It would also give me a chance to change symbol, font and image paths as well. But I guess that this won't be possible using QGis' Python API.

Answered by christoph on January 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP