[QGIS-Developer] Why is data source both in layer-tree-layer and in maplayer?

Thomas Larsen Wessel mrvelle at gmail.com
Sat Jul 27 08:51:47 PDT 2024


I created an empty qgis project, then chose New GeoPackage Layer, chose a
new file "foo.gpkg" and layername "mytable".

Everything seems fine. But if I save, and reopen the project it cant find
the source. So I inspect the qgz XML and find the source for the layer in
two places:

### Layer-Tree-Layer:

<layer-tree-layer
    id="mytable_d645cad7_6637_434d_9295_dc62a7ff198e"
    source="./foo.gpkg|layername=mytable"
    legend_split_behavior="0"
    name="mytable" expanded="1"
    checked="Qt::Checked"
    providerKey="ogr"
    legend_exp=""
    patch_size="-1,-1"
>

### MapLayer

<projectlayers>
    <maplayer (...) >
        <id>mytable_d645cad7_6637_434d_9295_dc62a7ff198e</id>

<datasource>../../OneDrive/Dokumenter/foo.gpkg|layername=mytable</datasource>
        (...)
        <layername>foo — mytable</layername>
        (...)
    </maplayer>
</projectlayers>


The latter for some reason has a wrong value in datasource. I have no
projects or data files in that location, so I guess QGIS somehow defaulted
to my users document folder. This seems like some kind of bug.

But I wonder, why, in the first place, is datasource in two different
places in that file?

Running QGIS 3.36.3 on Windows 10.

Sincerely, Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240727/eba7cb29/attachment.htm>


More information about the QGIS-Developer mailing list