On Wed, 2 Dec 2020 18:52:31 -0500, Nicolas Cadieux <[email protected]> wrote:
I just find out a "hint" I have in my "hints" directory with the following content: ===============8<----- tif_to_Geopackage --------- http://www.qfield.org/docs/project-management/dataformat.html Use GeoPackage We recommend to us the geopackage format to deal with raster data. The following commands will convert a file called raster.tif to a file raster.gpkg with pyramids. Make sure you adjust EPSG:21781 (CH1903 LV03) to your desired CRS. gdal_translate --config OGR_SQLITE_SYNCHRONOUS OFF -co APPEND_SUBDATASET=YES -co TILE_FORMAT=PNG_JPEG -a_srs EPSG:21781 -of GPKG raster.tif raster.gpkg gdaladdo --config OGR_SQLITE_SYNCHRONOUS OFF -r AVERAGE raster.gpkg 2 4 8 16 32 64 128 256 ===============8<----- tif_to_Geopackage --------- HTH > Hi, > Just to close this thread, this is the answer I got from Even Rouault > on the gdal dev mailing list. > > > > 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 > Roxo -- ---------------- Non luctari, ludare -------------------+ WYSIWYG Fernando M. Roxo da Motta <[email protected]> | Editor? Except where explicitly stated I speak on my own behalf.| VI !! PU5RXO | I see text, ------------ Quis custodiet ipsos custodes?-------------+ I get text! _______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
