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

Vedran Stojnović phidrho at gmail.com
Sun Jul 28 01:25:17 PDT 2024


Hi Thomas,

GIS stores project files and data files separately.
Did you create a temporary layer or a permanent one?
You can also change in Project settings type of stored Path
(absolute/relative) inside project file.
--
- poslano s mobitela -
Srdačan pozdrav,
Vedran Stojnović.

On Sat, Jul 27, 2024, 17:52 Thomas Larsen Wessel via QGIS-Developer <
qgis-developer at lists.osgeo.org> wrote:

> 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
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240728/5494c620/attachment.htm>


More information about the QGIS-Developer mailing list