[Qgis-developer] Saving a project using QGIS (Python) API loses mapcanvas and other XML nodes

Martin Dobias wonder.sk at gmail.com
Sun Dec 7 21:35:30 PST 2014


On Mon, Dec 1, 2014 at 8:10 PM, Alberti, K. (Koko) <K.Alberti at uu.nl> wrote:
> Hi qgis-dev,
> Apologies for the crosspost (on GIS stackexchange [1]), but I'm hoping this is a more appropriate audience for my question. I'm trying to open, manipulate, and save a QGIS project file using a standalone python script. However, upon saving the project, the output file is missing the <mapcanvas> and <legend> XML nodes. Does anyone know why this happens and if it is the expected behaviour or that something else is going on? When these nodes are missing and the project is then served via QGIS server the GetProjectSettings request breaks.

Yes this is indeed expected behavior (although not necessarily very
nice). In QGIS application environment there are various components
that are connected to readProject() and writeProject() signals from
QgsProject and they read/write their own configuration - map canvas is
one of them.


More information about the Qgis-developer mailing list