Bug report #20050

GPKG and SQLite files containing raster layers are incorrectly added to the map

Added by Andrea Giudiceandrea almost 2 years ago. Updated over 1 year ago.

Status:Open
Priority:Normal
Assignee:-
Category:Data Provider
Affected QGIS version:3.4.5 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27872

Description

1) When a geopackage file contains only 1 raster layer and you drag and drop the GPKG file into the map or you use the "Data Source Manager / Raster" dialog window to add the layer to the map, then:

the layer is automatically added (without the "Select Raster Layers to Add..." dialog window appearing) only like

filepath\filename.gpkg

instead of
GPKG:filepath/filename.gpkg:raster_layer_name

See Issue #20031 and PR https://github.com/qgis/QGIS/pull/8127 about the a similar issue fixed for vector layers import.

Moreover, the raster layer name is set to "filename" instead of a proper name like "raster_layer_name" or "filename raster_layer_name" (as for vector layers).

2) When a geopackage file contains more then 1 raster layer and you drag and drop the GPKG file into the map or you use the "Data Source Manager / Raster" dialog window to add the layer to the map, then:

the "Select Raster Layers to Add..." dialog window appears showing only values in the "Layers ID" column but with the "Layer name" column blank

The selected raster layer(s) are then added with a correct source like

GPKG:filepath/filename.gpkg:raster_layer_name

but with a blank name instead of a proper name like "raster_layer_name" or "filename raster_layer_name" (as for vector layers).

3) When a geopackage file contains both raster layer(s) and vector layer(s) and you drag and drop the GPKG file in the map, then only raster layer(s) will be added to the map: if there is only 1 raster layer you'll fall back again in the above first case, if there are more then 1 layer you'll fall back again in the above second case.

Using the "Data Source Manager" dialog window, with the "Vector" tab you can add the contained vector layer(s) without problems, but trying to add the raster layer(s) with the "Raster" tab you will fall back again in the above first or second cases.

4) Using instead the Browser panel, raster layers in a geopackage GPKG file are always correctly added to the map with a source like:

GPKG:filepath/filename.gpkg:raster_layer_name

and with the name of "raster_layer_name".

EDIT:

These strange and incorrect behaviours also happen for SQlite files containing rasterlite raster layers.

1), 2), 3) are almost the same as the above ones, except that the source string for rasterlite rasters it's like

RASTERLITE:filepath/filename.sqlite,table=rasterlite_layer_name

4) With the Browser panel is not possible to add to the map the rasterlite rasters contained in a sqlite file, but only the related metadata tables.

1rlayer.gpkg - 1 raster layer named "byte" (100 KB) Andrea Giudiceandrea, 2018-10-08 04:04 PM

1vlayer+1rlayer.gpkg - 1 vector layer named "vlayer" and 1 raster layer named "byte" (128 KB) Andrea Giudiceandrea, 2018-10-08 04:04 PM

1vlayer+2rlayer.gpkg - 1 vector layer named "vlayer" and 2 raster layers named "byte" and "float" (160 KB) Andrea Giudiceandrea, 2018-10-08 04:04 PM

2rlayer.gpkg - 2 raster layer named "byte" and "float" (140 KB) Andrea Giudiceandrea, 2018-10-08 04:04 PM

History

#1 Updated by Andrea Giudiceandrea almost 2 years ago

#2 Updated by Andrea Giudiceandrea over 1 year ago

  • Description updated (diff)
  • Subject changed from Geopackage GPKG files containing raster layers are incorrectly added to the map to GPKG and SQLite files containing raster layers are incorrectly added to the map

#3 Updated by Andrea Giudiceandrea over 1 year ago

  • Affected QGIS version changed from 3.3(master) to 3.4.0

Confirmed on 3.4.0

#4 Updated by Andrea Giudiceandrea over 1 year ago

  • Affected QGIS version changed from 3.4.0 to 3.4.5

Confirmed also with both QGIS LTR 3.4.5-1 (89ee6f6e23) and QGIS master 3.7.0-9 (37faa0d883) on Windows 7 64 bit.

In addition to the previously reported behaviour, with QGIS LTR 3.4.5 (but not with 3.3, 3.4.0, 3.7), if a GPKG or an SQLite file containing more then one raster layer (see reported cases 2 and 3) is dragged and dropped in the map, the following critical error is also displayed in the QGIS Message bar

Invalid Data Source: C:/TEST/2rlayer.gpkg is not a valid or recognized data source.

and the Log Messages panel reports

in the Messages tab

CRITICAL    Invalid Data Source : C:/TEST/2rlayer.gpkg is not a valid or recognized data source.

in the General tab
WARNING    Unable to load C:/TEST/2rlayer.gpkg

although the raster layers are added to the map.

Those errors are not displayed using the Data Source Manager dialog window or the Browser panel.

Also available in: Atom PDF