On mercredi 2 décembre 2020 15:16:44 CET Nicolas Cadieux wrote: > Hi, > > This follows a discussion in the qgis-user mailing list. We are using > gdal_translate (and QGIS "export as") on a 8bit unsigned single band > tiff to a .gpkg. When using no -ot switch or when using -ot Byte, this > results in a 4 band .gpkg raster with the wrong values. (Values in band > 1 to 3 are similar but off the mark). Band 4 is set at 255 as expected. > Looks like some type of compression is going on in the band 1 to 3). > > When saving using the -ot Int16 or Float32 switch, all is well and the > result has one band with the correct values. > > ex: gdal_translate -ot Int16 -of GPKG "E:/Users/Nicolas/Google Drive > Nicolas/Partage_temporaire/qgis/int16.gpkg" "E:/Users/Nicolas/Google > Drive Nicolas/Partage_temporaire/qgis/int16.gpkg" > > Is this a possible problem with the driver or is the problem sitting 18 > inches in front of the screen? Problem similar on a Mac running QGIS > 3.10.1-A with GDAL 3.0.2 and QGIS3.16 on Windows running GDAL 3.1.4. > > Test files are found here: > https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp > =sharing >
The answer is there: https://gdal.org/drivers/raster/gpkg.html#tile-formats For Byte input (that isn't recognized as to be used by the tiled gridded coverage data), the default tile format will use JPEG lossy compression for tiles with a fully opaque channel. -co TILE_FORMAT=PNG will use lossless compression GeoPackage raster aim was initially for visualisation purposes, hence this default. The more analytic side was a later addition to the format, and actually an extension Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
