[Qgis-user] R: Importing a raster into a Geopackage

2020-12-03 Thread Alberto Vavassori
Thank you both for the help. Now it seems to work for me, too!
Alberto

Da: Nicolas Cadieux 
Inviato: giovedì 3 dicembre 2020 00:53
A: Alberto Vavassori 
Cc: qgis-user@lists.osgeo.org
Oggetto: Re: [Qgis-user] Importing a raster into a Geopackage


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 
mailto:alberto.vavass...@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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-02 Thread Kirk Schmidt

Hi Nicolas:

I reached out to Alberto for the original data as the one on google 
drive did not contain georeferencing and therefore would not write to a 
geopackage.  I tried to write the geopackafge from Alberto's data and I 
generated 3 bands.  I just got back from a meeting and I will play with 
it some more.


Kirk

On 12/2/2020 12:10 PM, Nicolas Cadieux wrote:

Hi Alberto,

Can I share the file and your question in the gdal dev group?  Perhaps 
they will have an answer to your problem. You can also do that 
yourself if you prefer.


Kirt, if you have time, can you do the same run with the data in my 
google link?  If you can’t duplicate the problem, then we will have a 
better idea if you share your QGIS version and OS. Perhaps there is 
change in the gdal version between both computers.


Nicolas Cadieux
https://gitlab.com/njacadieux <https://gitlab.com/njacadieux>

Le 2 déc. 2020 à 10:11, Alberto Vavassori 
 a écrit :




Hi Kirk,

I tried with another raster file that represents a temperature 
distribution (continuous values). In this case, when I import it into 
the Geopackage, I see the same issue that you have just described: 
minimum and maximum values in the legend change, but it seems that 
the actual values remain unchanged, thus correct. Unfortunately this 
is not the case of the land cover raster (discrete set of values) 
that I have shared with you: in this case, the raster characteristics 
change, as we have all noticed.


Just another question, hoping that you might have an answer: is it 
possible to store the symbology of a raster file inside the 
Geopackage? I know that it is possible for vector data, by clicking 
on “Style > Save style” in the “Symbology” tab. But I cannot find a 
way to save the symbology in case of raster files.


Thanks a lot.

Alberto

*Da:* Qgis-user  *Per conto di 
*Kirk Schmidt

*Inviato:* mercoledì 2 dicembre 2020 16:00
*A:* Nicolas Cadieux ; 
qgis-user@lists.osgeo.org

*Oggetto:* Re: [Qgis-user] R: Importing a raster into a Geopackage

Hi all:

I ran the r.stats to get a list of each pixel value on my test data 
(A small DEM) before and after conversion to a geopackage (see second 
image below). The values and summary stats are identical for the two 
rasters but the default legend entry has a different min and maximum 
value.  So, I can conclude that the data is being written correctly 
but the default display parameters for the geopackage  are different 
than a geotiff.


Kirk




On 12/1/2020 3:24 PM, Nicolas Cadieux wrote:

Hi,

I changed the link so you have access to more files.


https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp=sharing

<https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp=sharing>

Nicolas

On 2020-12-01 1:58 p.m., Kirk Schmidt wrote:

Hi Nicolas

I did the same and the legend indicates a change magnitude
but if I subtract the geopackage raster from the original,
all pixels equal zero.

Kirk

On 12/1/2020 2:36 PM, Nicolas Cadieux wrote:

Hi,

Tried this:

gdal_translate -of GPKG -b 1
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif
C:/Users/Nicolas/Desktop/test.gpkg

I read 4 band and still get data modifications.

Nicolas

On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:

Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote
a single band raster from a 3 channel tiff.

Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:

I tried

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

C:\>gdal_translate -of GPKG -co "TILE_FORMAT =
TIFF"
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif
C:/Users/Nicolas/Desktop/TEST.gpkg

Same problem.  I wonder if we need to change the
reading options...
https://gdal.org/drivers/raster/gpkg.html
<https://gdal.org/drivers/raster/gpkg.html>


"Opening options

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."

The problem could be when QGIS Reads the file,
not when it writes 

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-02 Thread Nicolas Cadieux
Hi Alberto,

Can I share the file and your question in the gdal dev group?  Perhaps they 
will have an answer to your problem. You can also do that yourself if you 
prefer.

Kirt, if you have time, can you do the same run with the data in my google 
link?  If you can’t duplicate the problem, then we will have a better idea if 
you share your QGIS version and OS. Perhaps there is change in the gdal version 
between both computers.

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 2 déc. 2020 à 10:11, Alberto Vavassori  a 
> écrit :
> 
> 
> Hi Kirk,
> I tried with another raster file that represents a temperature distribution 
> (continuous values). In this case, when I import it into the Geopackage, I 
> see the same issue that you have just described: minimum and maximum values 
> in the legend change, but it seems that the actual values remain unchanged, 
> thus correct. Unfortunately this is not the case of the land cover raster 
> (discrete set of values) that I have shared with you: in this case, the 
> raster characteristics change, as we have all noticed.
> Just another question, hoping that you might have an answer: is it possible 
> to store the symbology of a raster file inside the Geopackage? I know that it 
> is possible for vector data, by clicking on “Style > Save style” in the 
> “Symbology” tab. But I cannot find a way to save the symbology in case of 
> raster files.
> Thanks a lot.
> Alberto
>  
> Da: Qgis-user  Per conto di Kirk Schmidt
> Inviato: mercoledì 2 dicembre 2020 16:00
> A: Nicolas Cadieux ; qgis-user@lists.osgeo.org
> Oggetto: Re: [Qgis-user] R: Importing a raster into a Geopackage
>  
> Hi all:
> 
> I ran the r.stats to get a list of each pixel value on my test data (A small 
> DEM) before and after conversion to a geopackage (see second image below).  
> The values and summary stats are identical for the two rasters but the 
> default legend entry has a different min and maximum value.  So, I can 
> conclude that the data is being written correctly but the default display 
> parameters for the geopackage  are different than a geotiff. 
> 
> Kirk
> 
>  
> 
> 
> 
> 
> 
> On 12/1/2020 3:24 PM, Nicolas Cadieux wrote:
> Hi,
> 
> I changed the link so you have access to more files.
> 
> https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp=sharing
> 
> Nicolas
> 
> On 2020-12-01 1:58 p.m., Kirk Schmidt wrote:
> Hi Nicolas
> 
> I did the same and the legend indicates a change magnitude but if I subtract 
> the geopackage raster from the original, all pixels equal zero.
> 
> Kirk
> 
> On 12/1/2020 2:36 PM, Nicolas Cadieux wrote:
> Hi,
> 
> Tried this:
> 
> gdal_translate -of GPKG -b 1 
> C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
> C:/Users/Nicolas/Desktop/test.gpkg
> 
> I read 4 band and still get data modifications.
> 
> Nicolas
> 
> On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:
> Hi Nicolas:
> 
> try the -b 1 parameter.  I just tried this and wrote a single band raster 
> from a 3 channel tiff.
> 
> Kirk
> 
> On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:
> I tried
> 
> 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
> 
> C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
> C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
> C:/Users/Nicolas/Desktop/TEST.gpkg
> 
> Same problem.  I wonder if we need to change the reading options... 
> https://gdal.org/drivers/raster/gpkg.html
> 
> "Opening options
> 
> 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."
> 
> 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.
> 
> Nicolas
> 
>  
> 
> On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
> This looks like the same issue you are having. 
> github.com/qgis/QGIS/issues/38227
> According to the documentation linked in the issue you need to set the band 
> count to 1 otherwise it defaults to 4. 
> gdal.org/drivers/raster/gpkg.html
> I have not tried this to see if it works. 
>  
> On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux  
> wrote:
> Hi,
> 
> Looking at it now.  I see what you see.  I will try a few things

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-02 Thread Kirk Schmidt

Hi all:

I ran the r.stats to get a list of each pixel value on my test data (A 
small DEM) before and after conversion to a geopackage (see second image 
below).  The values and summary stats are identical for the two rasters 
but the default legend entry has a different min and maximum value.  So, 
I can conclude that the data is being written correctly but the default 
display parameters for the geopackage  are different than a geotiff.


Kirk


On 12/1/2020 3:24 PM, Nicolas Cadieux wrote:


Hi,

I changed the link so you have access to more files.

https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp=sharing

Nicolas

On 2020-12-01 1:58 p.m., Kirk Schmidt wrote:


Hi Nicolas

I did the same and the legend indicates a change magnitude but if I 
subtract the geopackage raster from the original, all pixels equal zero.


Kirk

On 12/1/2020 2:36 PM, Nicolas Cadieux wrote:


Hi,

Tried this:

gdal_translate -of GPKG -b 1 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/test.gpkg


I read 4 band and still get data modifications.

Nicolas

On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:


Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote a single band 
raster from a 3 channel tiff.


Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:


I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading 
options... https://gdal.org/drivers/raster/gpkg.html



"Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to 
set the band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
> wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am
interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org

*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux




Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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 

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Nicolas Cadieux

Hi,

I changed the link so you have access to more files.

https://drive.google.com/drive/folders/1fMl9odowUFFRQFK61rTxgHeom_D8ymN6?usp=sharing

Nicolas

On 2020-12-01 1:58 p.m., Kirk Schmidt wrote:


Hi Nicolas

I did the same and the legend indicates a change magnitude but if I 
subtract the geopackage raster from the original, all pixels equal zero.


Kirk

On 12/1/2020 2:36 PM, Nicolas Cadieux wrote:


Hi,

Tried this:

gdal_translate -of GPKG -b 1 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/test.gpkg


I read 4 band and still get data modifications.

Nicolas

On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:


Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote a single band 
raster from a 3 channel tiff.


Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:


I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading options... 
https://gdal.org/drivers/raster/gpkg.html



"Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set 
the band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> 
wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am
interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org

*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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

___

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Nicolas Cadieux

Same here, very different results

https://drive.google.com/file/d/1GyIhYMWSdZFtI4uHQOLOyJpmcqDLrx4K/view?usp=sharing

I'am on 3.16.1, Window 10

Nicolas

On 2020-12-01 1:58 p.m., Kirk Schmidt wrote:


Hi Nicolas

I did the same and the legend indicates a change magnitude but if I 
subtract the geopackage raster from the original, all pixels equal zero.


Kirk

On 12/1/2020 2:36 PM, Nicolas Cadieux wrote:


Hi,

Tried this:

gdal_translate -of GPKG -b 1 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/test.gpkg


I read 4 band and still get data modifications.

Nicolas

On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:


Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote a single band 
raster from a 3 channel tiff.


Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:


I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading options... 
https://gdal.org/drivers/raster/gpkg.html



"Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set 
the band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> 
wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am
interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org

*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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

___
   

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Kirk Schmidt

Hi Nicolas

I did the same and the legend indicates a change magnitude but if I 
subtract the geopackage raster from the original, all pixels equal zero.


Kirk

On 12/1/2020 2:36 PM, Nicolas Cadieux wrote:


Hi,

Tried this:

gdal_translate -of GPKG -b 1 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/test.gpkg


I read 4 band and still get data modifications.

Nicolas

On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:


Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote a single band 
raster from a 3 channel tiff.


Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:


I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading options... 
https://gdal.org/drivers/raster/gpkg.html



"Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set 
the band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> 
wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am
interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org 
*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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@lists.osgeo.org

List info:
https://lists.osgeo.org/mailman/listinfo/qgis-user
   

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Nicolas Cadieux

Hi,

Tried this:

gdal_translate -of GPKG -b 1 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/test.gpkg


I read 4 band and still get data modifications.

Nicolas

On 2020-12-01 1:28 p.m., Kirk Schmidt wrote:


Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote a single band 
raster from a 3 channel tiff.


Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:


I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading options... 
https://gdal.org/drivers/raster/gpkg.html



"Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set 
the band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> 
wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am
interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org 
*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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@lists.osgeo.org

List info:
https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-user



Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Kirk Schmidt

Hi Nicolas:

try the -b 1 parameter.  I just tried this and wrote a single band 
raster from a 3 channel tiff.


Kirk

On 12/1/2020 2:03 PM, Nicolas Cadieux wrote:


I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading options... 
https://gdal.org/drivers/raster/gpkg.html



"Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set 
the band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org 
*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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@lists.osgeo.org 
List info:
https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-user


-- 
Nicolas Cadieux

https://gitlab.com/njacadieux  


-- 
Nicolas Cadieux

https://gitlab.com/njacadieux  

___
Qgis-user 

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Nicolas Cadieux

Hi Sebastian and others,

I think the github has it wrong here  According to the documentation, 
the band count option is for _reading_ the file and not creating the 
file.  What I don't get is the fact that the data is being changed 
significantly (but not as much as when the "rendered image" option is 
selected (as expected) so that's not the problem here).   I tried 
QUALITY = 100 for writing to see if some compression was going on but 
it's the same problem.  Looks like some scaling issues.  The 1 to 4 band 
is not a problem (as this is the standard read option) but the value 
changes are.


gdal_translate -of GPKG -co "QUALITY = 100" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Nicolas

On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set the 
band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org 
*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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@lists.osgeo.org 
List info:
https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-user


-- 
Nicolas Cadieux

https://gitlab.com/njacadieux  


-- 
Nicolas Cadieux

https://gitlab.com/njacadieux  

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org 
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user



--
Nicolas Cadieux
https://gitlab.com/njacadieux


Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Nicolas Cadieux

I tried

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


C:\>gdal_translate -of GPKG -co "TILE_FORMAT = TIFF" 
C:/Users/Nicolas/Desktop/Land_cover_Corine2018.tif 
C:/Users/Nicolas/Desktop/TEST.gpkg


Same problem.  I wonder if we need to change the reading options... 
https://gdal.org/drivers/raster/gpkg.html



   "Opening options

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."


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.


Nicolas


On 2020-12-01 12:17 p.m., Sebastian Gutwein wrote:
This looks like the same issue you are having. 
github.com/qgis/QGIS/issues/38227 

According to the documentation linked in the issue you need to set the 
band count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html 


I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> wrote:


Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am interested in.

Alberto

*Da:*Nicolas Cadieux 

*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 

*Cc:* qgis-user@lists.osgeo.org 
*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help:
https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to
GeoPackage raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with
alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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@lists.osgeo.org 
List info:
https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-user


-- 
Nicolas Cadieux

https://gitlab.com/njacadieux  


-- 
Nicolas Cadieux

https://gitlab.com/njacadieux  

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org 
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Sebastian Gutwein
This looks like the same issue you are having.
github.com/qgis/QGIS/issues/38227
According to the documentation linked in the issue you need to set the band
count to 1 otherwise it defaults to 4.
gdal.org/drivers/raster/gpkg.html
I have not tried this to see if it works.

On Tue, Dec 1, 2020 at 11:52 AM Nicolas Cadieux 
wrote:

> Hi,
>
> Looking at it now.  I see what you see.  I will try a few things.
>
> Nicolas
> On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:
>
> Hi Nicolas,
>
> thank you for the answer. I send the raster that I am interested in.
>
> Alberto
>
>
>
> *Da:* Nicolas Cadieux 
> 
> *Inviato:* martedì 1 dicembre 2020 17:40
> *A:* Alberto Vavassori 
> 
> *Cc:* qgis-user@lists.osgeo.org
> *Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage
>
>
>
> Hi,
>
> Send a sample data set if you can't figure it out.
>
> Nicolas
>
> On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:
>
> Hi,
>
> Perhaps this can help: https://gdal.orgdrivers/raster/gpkg.html
>
>
>
> “Various kind of input datasets can be converted to GeoPackage raster :
>
> ·Single band grey level
>
> ·Single band with R,G,B or R,G,B,A color table
>
> ·Two bands: first band with grey level, second band with alpha
> channel
>
> ·Three bands: Red, Green, Blue
>
> ·Four band: Red, Green, Blue, Alpha
>
> GeoPackage rasters only support Byte data type.”
>
> 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.
>
>
>
> Nicolas Cadieux
>
> https://gitlab.com/njacadieux
>
>
>
> Le 1 déc. 2020 à 09:58, Alberto Vavassori 
>  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@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
> --
>
> Nicolas Cadieux
>
> https://gitlab.com/njacadieux
>
> --
> Nicolas Cadieuxhttps://gitlab.com/njacadieux
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Nicolas Cadieux

Hi,

Looking at it now.  I see what you see.  I will try a few things.

Nicolas

On 2020-12-01 11:42 a.m., Alberto Vavassori wrote:


Hi Nicolas,

thank you for the answer. I send the raster that I am interested in.

Alberto

*Da:*Nicolas Cadieux 
*Inviato:* martedì 1 dicembre 2020 17:40
*A:* Alberto Vavassori 
*Cc:* qgis-user@lists.osgeo.org
*Oggetto:* Re: [Qgis-user] Importing a raster into a Geopackage

Hi,

Send a sample data set if you can't figure it out.

Nicolas

On 2020-12-01 10:35 a.m., Nicolas Cadieux wrote:

Hi,

Perhaps this can help: https://gdal.orgdrivers/raster/gpkg.html


“Various kind of input datasets can be converted to GeoPackage
raster :

·Single band grey level

·Single band with R,G,B or R,G,B,A color table

·Two bands: first band with grey level, second band with alpha channel

·Three bands: Red, Green, Blue

·Four band: Red, Green, Blue, Alpha

GeoPackage rasters only support Byte data type.”

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.

Nicolas Cadieux

https://gitlab.com/njacadieux 



Le 1 déc. 2020 à 09:58, Alberto Vavassori

 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@lists.osgeo.org 
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-user


--
Nicolas Cadieux
https://gitlab.com/njacadieux  


--
Nicolas Cadieux
https://gitlab.com/njacadieux

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] R: Importing a raster into a Geopackage

2020-12-01 Thread Alberto Vavassori
Hello Kirk,
I tried both options (raw data and rendered image), but none of them solve the 
problem. This is a screenshot of the configuration panel.
Alberto

Da: Qgis-user  Per conto di Kirk Schmidt
Inviato: martedì 1 dicembre 2020 16:56
A: qgis-user@lists.osgeo.org
Oggetto: Re: [Qgis-user] Importing a raster into a Geopackage


Hello Alberto:

I just tried saving a dem (single band raster) as a geopackage using QGIS 
3.10.1.  The only issue I can think of is if you select rendered vs raw data in 
the export dialog (see top of screen shot below).

Can you share the version you are using?

Kirk

[cid:image001.png@01D6C805.51595910]
On 12/1/2020 10:56 AM, Alberto Vavassori wrote:
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@lists.osgeo.org

List info: https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

--

Kirk Schmidt, MScF, BScF, RPF

General Manager

Nortek Resource Solutions Inc.

RR # 1

Thorburn, NS

B0K 1W0

Tel (902) 922.3607

Email: k...@nortekresources.com

Web: www.nortekresources.com
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user