[Qgis-user] Importing a raster into a Geopackage
Nicolas Cadieux
njacadieux.gitlab at gmail.com
Wed Dec 2 15:52:31 PST 2020
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
--
Spatialys - Geospatial professional services
http://www.spatialys.com
> Le 1 déc. 2020 à 09:58, Alberto Vavassori <alberto.vavassori at polimi.it> a écrit :
>
>
> Hello everybody. I have an issue regarding the Geopackage format. I have tried to import a singleband raster file (it represents the land cover, thus every pixel has a single integer value corresponding to the land cover class), but this operation seems to modify the raster characteristics: the raster becomes a 4-bands raster and the pixels values change accordingly (basically, the original raster is saved in the Geopackage as an RGB image). It seems to be a bug of QGIS. I have also tried to use GDAL translate through the processing toolbox of QGIS to convert the TIFF file to a Geopackage file, but the result is the same.
> Has anybody faced this problem? May anybody suggest a way to work this problem out?
> Thank you.
> Alberto
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20201202/3b78c70c/attachment.html>
More information about the Qgis-user
mailing list