Bug report #16884
Can't add GeoPackage layer if gpkg_contents extents are invalid
|Affected QGIS version:||2.18.10||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||up/downstream|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||24783|
GeoPackages provide an informative set of extents for each layer in gpkg_contents. In theory those extents represent a logical view that can be applied after the layer is added. However, if those extents are invalid for any reason (for example, minY and maxX swapped), the layer can't be added at all.
Invalid Layer: GDAL provider Cannot open GDAL dataset /Users/JeffYutzler/Data/ek7demo/ek7demo.gpkg: Illegal min_x/min_y/max_x/max_y values for osm_tiles (file: src/providers/gdal/qgsgdalprovider.cpp row: 174function QgsGdalProvider:) Raster layer Provider is not valid (provider: gdal, URI: /Users/JeffYutzler/Data/ek7demo/ek7demo.gpkg (file: src/core/raster/qgsrasterlayer.cpp row: 668function setDataProvider:)
Add the layer, just ignore the invalid extents (don't zoom in or anything) and maybe give an informative message.
#2 Updated by Jeff Yutzler almost 3 years ago
Note: I first discovered the issue with a raster dataset, not vector.
Test data: https://portal.opengeospatial.org/files/?artifact_id=74866&version=1 (note: > 400MB file)
#3 Updated by Even Rouault almost 3 years ago
The ticket is purely a GDAL one so should be opened in the GDAL bug tracker ( https://trac.osgeo.org/gdal/newticket ). Interestingly I see there's actually no requirements for the gpkg_contents bbox to be even a valid one with min_x < max_x and min_y < max_y. So yes the driver is probably a bit too picky and should default to using the extent of gpkg_tile_matrix_set as it would do if there was no gpkg_contents bbox at all.
The link you provide to the dataset is not accessible without OGC credentials.