qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.55k stars 2.99k forks source link

Styles stored inside a GeoPackage are not found anymore by QGIS #58467

Open brandtf opened 2 months ago

brandtf commented 2 months ago

[Edit 2024-09-10: Update of expired download link.]

What is the bug or the crash?

During the switch from QGIS-LTR 3.28 to QGIS-LTR 3.34, I noticed some serious problems in the recognition of layer styles inside a GPKG, which also persist in QGIS 3.38. I have a GPKG with multiple styles in table "layer_styles" (ca. 100). The GPKG serves as a template and the correct association of the correct styles and layers is normally done automatically by a script, as there are sometimes multiple saved styles for the same GPKG table (for points, lines and polygons).

grafik

Since the switch of the version, in some cases, for some layers (= GPKG tables), the function "layer.listStylesInDatabase()" remains empty, although there ARE styles saved inside the GPKG for the associated GPKG tables. The lack of found styles can be reproduced manually by a filled GPKG (see below). The styles are not visible in the GUI of QGIS 3.34 or 3.38 but are visible in QGIS 3.28.

GPKG-Download: Link: https://dap.thueringen.de/s/mSLT23QDEDJf63E Password: NaIIC80zZzUP

Steps to reproduce the issue

I made an upload with a GPKG , as I was not be able to reproduce the issue with very "simple steps" (i.e. just make 3 layers and 3 styles). It only occures in big GPKGs with multiple styles, and even multiple styles for the same GPKG table.

  1. Load the GPKG inside QGIS (Drag´n´Drop)
  2. Load all Layers (as group)
  3. Properties of Layer: ax_landwirtschaft
  4. Style --> Load style --> From source database
  5. You will see: No style associated with layer, only one other style in database (AX_Wohnplatz_P)
  6. You can´t assign a style that is not shown (and even not found in PyQGIS).

grafik

But:

  1. Properties of Layer: ax_bauwerkimgewaesserbereich
  2. Style --> Load style --> From source database
  3. You will see multiple styles for the layer (different spellings for testing) and all the other styles.
  4. That´s how it should be, But most of the other layers show no (other) styles.

grafik

In QGIS 3.28, all layer styles are found and displayed correctly, when you load the GPKG in the same way.

Versions

QGIS-Version | 3.38.2-Grenoble | QGIS-Codeversion | 130c432394

Qt-Version | 5.15.13 Python-Version | 3.12.5 GDAL-Version | 3.9.2 PROJ-Version | 9.4.0 EPSG-Registraturdatenbankversion | v11.004 (2024-02-24) GEOS-Version | 3.12.1-CAPI-1.18.1 SQLite-Version | 3.45.1 PDAL-Version | 2.6.3 PostgreSQL-Client-Version | 16.2 SpatiaLite-Version | 5.1.0 QWT-Version | 6.2.0 QScintilla2-Version | 2.14.1 BS-Version | Windows 11 Version 2009   |   |   |   Aktive Python-Erweiterungen GeoBasis_Loader | 0.6 GeoCoding | 2.19 plugin_reloader | 0.9.4 db_manager | 0.1.20 grassprovider | 2.12.99 MetaSearch | 0.3.6 processing | 2.12.99

Supported QGIS version

New profile

Additional context

No response

agiudiceandrea commented 2 months ago

On Windows 10 the issue doesn't occur using QGIS 3.32.3 (GDAL/OGR 3.7.2) while it does occur since QGIS 3.34.0 (GDAL/OGR 3.7.2). Hi @manisandro @elpaso , please have a look at this issue report about a regression using styles stored in a GPKG file.

elpaso commented 2 months ago

I cannot reproduce in current master.

agiudiceandrea commented 2 months ago

@elpaso, the issue occurs on Windows 10 even using QGIS 3.39.0-Master f90a7c04b1 (GDAL/OGR 3.10.0dev-b39ca5a8b5) form OSGeo4W.

image

elpaso commented 2 months ago

@agiudiceandrea

maybe my GDAL master fixed it?

immagine

agiudiceandrea commented 2 months ago

@elpaso, I don't think so, since the issue does occur on my Windows 10 system even running the latest QGIS 3.39.0-Master 343709f48a with the latest GDAL/OGR 3.10.0dev 526b28c086 from OSGeo4W.