Bug report #17103
QgsRasterFileWriter fails to export raster into a geopackage
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||25002|
Destination tables are created but they are empty.
See comments in https://github.com/qgis/QGIS/pull/5057#issuecomment-323992656
And a failing test case in: https://github.com/boundlessgeo/QGIS/commit/e4a81d277658d19557b76115870ab3ed9164f1cc#diff-9a0fc019f23587c8baa0bdb3ba89fbad
[GDAL provider] in create(), use newly create dataset handle to instanciate the provider (fix #17103)
Previously we created an empty file, close it and re-opened it immediately in open mode.
However for GeoPackage, if you create for example a 1 band or 3 band dataset, upon reopening
you get a 4 band RGBA dataset, due to the fact that GeoPackage doesn't explicitly store the
number of bands. Thus the 4th band (alpha) was never written by the QgsRasterFileWriter logic.