<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>Tried this:<br>
</p>
<p>gdal_translate -of GPKG -b 1
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif
C:/Users/Nicolas/Desktop/test.gpkg</p>
<p>I read 4 band and still get data modifications.</p>
<p>Nicolas<br>
</p>
<div class="moz-cite-prefix">On 2020-12-01 1:28 p.m., Kirk Schmidt
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:2a8cb288-13e4-17e2-a9f4-f5d38f5be283@nortekresources.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Hi Nicolas:</p>
<p>try the -b 1 parameter. I just tried this and wrote a single
band raster from a 3 channel tiff.</p>
<p>Kirk<br>
</p>
<div class="moz-cite-prefix">On 12/1/2020 2:03 PM, Nicolas Cadieux
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1e19158c-e195-f6e6-d839-8abb05739258@gmail.com">
<p>I tried <br>
</p>
<p>gdal_translate -of GPKG -co "BAND_COUNT=1"
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif
C:/Users/Nicolas/Desktop/TEST.gpkg for the creation and <br>
</p>
<p>C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF"
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif
C:/Users/Nicolas/Desktop/TEST.gpkg</p>
<p>Same problem. I wonder if we need to change the reading
options... <a class="moz-txt-link-freetext"
href="https://gdal.org/drivers/raster/gpkg.html"
moz-do-not-send="true">https://gdal.org/drivers/raster/gpkg.html</a></p>
<h2>"Opening options</h2>
<p>By default, the driver will expose a GeoPackage dataset as a
four band (Red,Green, Blue,Alpha) dataset, which gives the
maximum compatibility with the various encodings of tiles that
can be stored. It is possible to specify an explicit number of
bands with the BAND_COUNT opening option."</p>
<p>The problem could be when QGIS Reads the file, not when it
writes the file. I explains why we see 4 bands but not why
values are changing. I would make a bug report or ask the
question on the gdal dev group to get Even Rouault's
attention.<br>
</p>
<p>Nicolas<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 2020-12-01 12:17 p.m., Sebastian
Gutwein wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAED_52pFuAzSH3UtyR6S4M_dKBJ60pU2Jx1+P0Be2EOEOkGv7g@mail.gmail.com">
<div dir="ltr">This looks like the same issue you are having. <a
href="http://github.com/qgis/QGIS/issues/38227"
moz-do-not-send="true">github.com/qgis/QGIS/issues/38227</a>
<div>According to the documentation linked in the issue you
need to set the band count to 1 otherwise it defaults to
4. </div>
<div><a href="http://gdal.org/drivers/raster/gpkg.html"
moz-do-not-send="true">gdal.org/drivers/raster/gpkg.html</a><br>
</div>
<div>I have not tried this to see if it works. </div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Dec 1, 2020 at
11:52 AM Nicolas Cadieux <<a
href="mailto:njacadieux.gitlab@gmail.com"
moz-do-not-send="true">njacadieux.gitlab@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote">
<div>
<p>Hi,<br>
</p>
<p>Looking at it now. I see what you see. I will try a
few things.</p>
<p>Nicolas<br>
</p>
<div>On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:<br>
</div>
<blockquote type="cite">
<div>
<p class="MsoNormal"><span>Hi Nicolas,</span></p>
<p class="MsoNormal"><span lang="EN-US">thank you
for the answer. I send the raster that I am
interested in.</span></p>
<p class="MsoNormal"><span lang="EN-US">Alberto</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span>Da:</span></b><span>
Nicolas Cadieux <a
href="mailto:njacadieux.gitlab@gmail.com"
target="_blank" moz-do-not-send="true"><njacadieux.gitlab@gmail.com></a>
<br>
<b>Inviato:</b> martedì 1 dicembre 2020
17:40<br>
<b>A:</b> Alberto Vavassori <a
href="mailto:alberto.vavassori@polimi.it"
target="_blank" moz-do-not-send="true"><alberto.vavassori@polimi.it></a><br>
<b>Cc:</b> <a
href="mailto:qgis-user@lists.osgeo.org"
target="_blank" moz-do-not-send="true">qgis-user@lists.osgeo.org</a><br>
<b>Oggetto:</b> Re: [Qgis-user] Importing a
raster into a Geopackage</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p>Hi,<span></span></p>
<p>Send a sample data set if you can't figure it
out.</p>
<p>Nicolas</p>
<div>
<p class="MsoNormal">On 2020-12-01 10:35 a.m.,
Nicolas Cadieux wrote:</p>
</div>
<blockquote>
<p class="MsoNormal">Hi, </p>
<div>
<p class="MsoNormal">Perhaps this can help: <a
href="https://gdal.orgdrivers/raster/gpkg.html"
target="_blank" moz-do-not-send="true">https://gdal.orgdrivers/raster/gpkg.html</a></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p> <span>“Various kind of input datasets can
be converted to GeoPackage raster :</span></p>
<p> <span><span>·<span> </span></span></span><span>Single
band grey level</span></p>
<p> <span><span>·<span> </span></span></span><span>Single
band with R,G,B or R,G,B,A color table</span></p>
<p> <span><span>·<span> </span></span></span><span>Two
bands: first band with grey level, second
band with alpha channel</span></p>
<p> <span><span>·<span> </span></span></span><span>Three
bands: Red, Green, Blue</span></p>
<p> <span><span>·<span> </span></span></span><span>Four
band: Red, Green, Blue, Alpha</span></p>
<p> <span>GeoPackage rasters only support Byte
data type.”</span></p>
<p> <span>My guess is that if the original
raster does not correspond to one of the
categories above, it will be converted to
the closest format. </span></p>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">Nicolas Cadieux </p>
<div>
<p class="MsoNormal"><a
href="https://gitlab.com/njacadieux"
target="_blank" moz-do-not-send="true">https://gitlab.com/njacadieux</a></p>
</div>
</div>
<div>
<p class="MsoNormal"><br>
<br>
</p>
<blockquote>
<p class="MsoNormal">Le 1 déc. 2020 à 09:58,
Alberto Vavassori <a
href="mailto:alberto.vavassori@polimi.it"
target="_blank" moz-do-not-send="true"><alberto.vavassori@polimi.it></a>
a écrit :</p>
</blockquote>
</div>
<blockquote>
<div>
<p class="MsoNormal"> <span></span></p>
<p class="MsoNormal"><span lang="EN-US">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></p>
<p class="MsoNormal"><span lang="EN-US">Has
anybody faced this problem? May anybody
suggest a way to work this problem out?</span></p>
<p class="MsoNormal"><span lang="EN-US">Thank
you.</span></p>
<p class="MsoNormal"><span lang="EN-US">Alberto</span></p>
<p class="MsoNormal"><span>_______________________________________________<br>
Qgis-user mailing list<br>
<a
href="mailto:Qgis-user@lists.osgeo.org"
target="_blank" moz-do-not-send="true">Qgis-user@lists.osgeo.org</a><br>
List info: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></span></p>
</div>
</blockquote>
</div>
</blockquote>
<pre>-- </pre>
<pre>Nicolas Cadieux</pre>
<pre><a href="https://gitlab.com/njacadieux" target="_blank" moz-do-not-send="true">https://gitlab.com/njacadieux</a></pre>
</div>
</blockquote>
<pre cols="72">--
Nicolas Cadieux
<a href="https://gitlab.com/njacadieux" target="_blank" moz-do-not-send="true">https://gitlab.com/njacadieux</a></pre>
</div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank"
moz-do-not-send="true">Qgis-user@lists.osgeo.org</a><br>
List info: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Nicolas Cadieux
<a class="moz-txt-link-freetext" href="https://gitlab.com/njacadieux" moz-do-not-send="true">https://gitlab.com/njacadieux</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org" moz-do-not-send="true">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Kirk Schmidt, MScF, BScF, RPF
General Manager
Nortek Resource Solutions Inc.
RR # 1
Thorburn, NS
B0K 1W0
Tel (902) 922.3607
Email: <a class="moz-txt-link-abbreviated" href="mailto:kirk@nortekresources.com" moz-do-not-send="true">kirk@nortekresources.com</a>
Web: <a class="moz-txt-link-abbreviated" href="http://www.nortekresources.com" moz-do-not-send="true">www.nortekresources.com</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Nicolas Cadieux
<a class="moz-txt-link-freetext" href="https://gitlab.com/njacadieux">https://gitlab.com/njacadieux</a></pre>
</body>
</html>