<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.StileMessaggioDiPostaElettronica20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="IT" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">Thank you both for the help. Now it seems to work for me, too!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">Alberto<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="mso-fareast-language:IT">Da:</span></b><span style="mso-fareast-language:IT"> Nicolas Cadieux <njacadieux.gitlab@gmail.com>
<br>
<b>Inviato:</b> giovedì 3 dicembre 2020 00:53<br>
<b>A:</b> Alberto Vavassori <alberto.vavassori@polimi.it><br>
<b>Cc:</b> qgis-user@lists.osgeo.org<br>
<b>Oggetto:</b> Re: [Qgis-user] Importing a raster into a Geopackage<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><br>
Hi,<span style="mso-fareast-language:IT"><o:p></o:p></span></p>
<div>
<p class="MsoNormal">Just to close this thread, this is the answer I got from Even Rouault on the gdal dev mailing list.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">On mercredi 2 décembre 2020 15:16:44 CET Nicolas Cadieux wrote:</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Hi,</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">This follows a discussion in the qgis-user mailing list. We are using</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">gdal_translate (and QGIS "export as") on a 8bit unsigned single band</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">tiff to a .gpkg. When using no -ot switch or when using -ot Byte, this</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">results in a 4 band .gpkg raster with the wrong values. (Values in band</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">1 to 3 are similar but off the mark). Band 4 is set at 255 as expected. </span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Looks like some type of compression is going on in the band 1 to 3).</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">When saving using the -ot Int16 or Float32 switch, all is well and the</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">result has one band with the correct values.</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">ex: gdal_translate -ot Int16 -of GPKG "E:/Users/Nicolas/Google Drive</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Nicolas/Partage_temporaire/qgis/int16.gpkg" "E:/Users/Nicolas/Google</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Drive Nicolas/Partage_temporaire/qgis/int16.gpkg"</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Is this a possible problem with the driver or is the problem sitting 18</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">inches in front of the screen? Problem similar on a Mac running QGIS</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">3.10.1-A with GDAL 3.0.2 and QGIS3.16 on Windows running GDAL 3.1.4.</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Test files are found here:</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black"><a href="https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp">https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp</a></span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">=sharing</span><o:p></o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<p class="MsoNormal"><br>
The answer is there:<br>
<a href="https://gdal.org/drivers/raster/gpkg.html#tile-formats">https://gdal.org/drivers/raster/gpkg.html#tile-formats</a><br>
<br>
For Byte input (that isn't recognized as to be used by the tiled gridded <br>
coverage data), the default tile format will use JPEG lossy compression for <br>
tiles with a fully opaque channel.<br>
<br>
-co TILE_FORMAT=PNG will use lossless compression<br>
<br>
GeoPackage raster aim was initially for visualisation purposes, hence this <br>
default. The more analytic side was a later addition to the format, and <br>
actually an extension<br>
<br>
Even<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com/">http://www.spatialys.com</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:white">Le 1 déc. 2020 à 09:58, Alberto Vavassori <<a href="mailto:alberto.vavassori@polimi.it">alberto.vavassori@polimi.it</a>> a écrit :</span><o:p></o:p></p>
</blockquote>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="color:white"> </span><span style="mso-fareast-language:IT"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;color:white">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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;color:white">Has anybody faced this problem? May anybody suggest a way to work this problem out?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;color:white">Thank you.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;color:white">Alberto</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:white;mso-fareast-language:IT">_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></span><span style="mso-fareast-language:IT"><o:p></o:p></span></p>
</div>
</blockquote>
</div>
</div>
</body>
</html>