Hi Even, Thanks for you prompt answer!
Could you please point out a valid example on how to read/write a single byte raster dataset (preferably with a color table) in GPKG with any supported setup (tiling, format, padding etc)? GTiff also can store different band count, padding, etc, but there isn't a similar problem with it. I'm not sure I understand the difference. So I'm not sure I understand the RGBA expansion you were talking about, do you have a link to more info on that matter? Kind regards, Idan On Mon, 29 Oct 2018 at 14:29, Even Rouault <[email protected]> wrote: > On lundi 29 octobre 2018 14:19:12 CET Ben Avrahami wrote: > > Hello, I'm trying to save a byte raster to a geopackage. I ran into a > > problem that the geopackage raster driver does not behave as expected > when > > working with bytes and color tables. I have written a python script that > > explains the issue (attached): > > > > The script creates 4 rasters in similar ways but prints different > outputs: > > > > GTIFF(no palette): Minimum=0, Maximum=9, Color Table=False, band count=1 > > GTIFF(palette): Minimum=0, Maximum=9, Color Table=True, band count=1 > > GPKG(no palette): Minimum=0, Maximum=9, Color Table=False, band count=4 > > GPKG(palette): Minimum=0, Maximum=255, Color Table=False, band count=4 > > > > The problem is that even though we set a color table in the geopackage > when > > writing, it reads as having no color table when reading. Worse yet, the > > original raster values are lost when written with a color table. > > > > Is there any workaround or fix for this? We want to be able to keep > > non-image byte data with a palette to geopackage. > > > > Change > ds = gdal.OpenEx(path, gdal.OF_READONLY) > to > ds = gdal.OpenEx(path, gdal.OF_READONLY, open_options=['BAND_COUNT=1']) > > if you know that all the tiles have a color table. Note: that will not > work if > your raster is made of a single tile that has some padding (which seems to > be > the case in your demo code), because the driver has to expand to RGBA to > be > able to fill transparent pixels. > > The fact that you don't get excatly the characteristics of the input > dataset > comes from the fact that GPKG can store tiles of different formats, band > count, etc, so the driver defaults to exposing at RGBA as a safe setting > > -- > Spatialys - Geospatial professional services > http://www.spatialys.com > _______________________________________________ > gdal-dev mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
