qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.46k stars 2.99k forks source link

ECW Alpha/Transparency not showing on QGIS with GDAL 3.2.1 #41928

Closed thillyard closed 3 years ago

thillyard commented 3 years ago

Describe the bug Upon updating to QGIS 3.18.0-Zürich i am unable to show ECW Rasters with a Transparency band. 3Band (+Alpha) show only as 3 band (not recognising the alpha band in properties). And 4+Band rasters seem to show all but the alpha band.

How to Reproduce Loading any ECW raseter into a QGIS window seems to have the same issue

QGIS and OS versions

QGIS version 3.18.0-Zürich QGIS code revision bdef9fb3 Compiled against Qt 5.15.2 Running against Qt 5.15.2 Compiled against GDAL/OGR 3.2.1 Running against GDAL/OGR 3.2.1 Compiled against GEOS 3.9.1-CAPI-1.14.2 Running against GEOS 3.9.1-CAPI-1.14.2 Compiled against SQLite 3.33.0 Running against SQLite 3.33.0 Compiled against PDAL 2.2.0 Running against PDAL 2.2.0 (git-version: 38aa11) PostgreSQL Client Version 13.0 SpatiaLite Version 5.0.1-rc1 QWT Version 6.1.3 QScintilla2 Version 2.11.5 Compiled against PROJ 7.2.1 Running against PROJ Rel. 7.2.1, January 1st, 2021 OS Version Windows 10 Version 1909 Active python plugins db_manager; MetaSearch; processing

Additional context

gioman commented 3 years ago

any ECW raseter into a QGIS window seems to have the same issue

@thillyard don't know about "any", for example this

http://jrepetto.free.fr/ttmaps/files/BlueMarble.zip

loads fine.

Could please attach/link a problematic ECW? thanks.

thillyard commented 3 years ago

Yes, your example does load fine, but do those ECWs contain an Alpha/Transparency channel? Other software suggests your example has only 3 bands and not the 4th transparency band. My examples have 4+ bands with one of those bands being identified as transparency. I can't give an example ecw in it's full form, as all my examples are quite large. however below is an ERS file describing the bands as they appear in the ECWs A7056_PortPirie_50mm_RGB_A3f300_MGA2020z54_14-Feb-2021.txt

I also offer a screen grab from QGIS 3.18 (left), vs Global Mapper 22(right). There doesn't appear to be anything i can do to show show the transparency in QGIS image

gioman commented 3 years ago

Yes, your example does load fine, but do those ECWs contain an Alpha/Transparency channel?

@thillyard I could not find a free download sample that had the alpha channel/band. Can you point me to one?

I'm assuming that on QGIS versions < 3.18.0 it worked as expected?

Is this limited to ECW or it affects also GeoTiff for example?

gioman commented 3 years ago

or it affects also GeoTiff for example

@thillyard this is geotiff with an alpha band, and it works as expected. Can you confirm?

teste2.zip

thillyard commented 3 years ago

whoops, i' didn't mean to close this.. it still is an issue in the latest update on the installer I'll try and generate a small example to share of an ECW with an opacity/alpha/transparency channel.

thillyard commented 3 years ago

Hi, I can confirm that the example Geotiff you supplied does display correctly with the opacity layer: image

I can also confirm that the ECW opacity was properly displaying in earlier versions of QGIS (we tested it here on 3.06 and in 3.14). in the issue persists in QGIS LTR 3.16.4, so the issue began somewhere in earlier releases of 3.16

Below are your GeoTIFF examples converted to ECW with GeoCompressor, one as-is, and the other with a hole cut into it to prove the Geocompressor is doing it's thing correctly. What is strange here is that this example works in QGIS3.18. So the results are inconsistent. ECWTest.zip

I've been searching through a mass of ECW's i have and some show the transparency in QGIS as expected and some don't. it does not appear that the ECW was created in a different procedure - each ECW was created using the same method. What may be interesting is that the large ECW's don't render correctly, while the small ECWs do - from my observations so far. Could this be a limitation with the physical size of the ECW? Looking at other examples, this is currently looking like the most likely problem.

Here is an example of the same ECW opened in QGIS3.14 (left) and QGIS3.18 (right). You will note that 3.14 identifies the 5th band (transparency) whilst 3.18 does not. image image

I am seeking permission to supply you this ECW as an example, i'll upload it if/when i do. This is an example with the smallest footprint i've found so far, but the ECW size is >4gB

Cheers, Tyson Hillyard

thillyard commented 3 years ago

Hi,

I have got permission to share the above ECW, you can download it here: https://drive.google.com/file/d/1BIvhc5pv_4aIniAgVJZUIJBvcFTCQy6K/view?usp=sharing

I've had a little bit more of a play, and it seems that the issue appears once the ECW file size is >4.1gb

Not sure if this is a coincidence, but evidence points to it not being so.

Cheers, Tyson Hillyard

gioman commented 3 years ago

@thillyard this is likely to be a GDAL issue, not QGIS's.

This is "GDAL info" on an osgeo4w install

C:>gdalinfo --version GDAL 3.1.4, released 2020/10/20

C:>gdalinfo Z:\Downloads\ExampleECW\EXAMPLE.ecw Driver: ECW/ERDAS Compressed Wavelets (SDK 5.3) Files: Z:\Downloads\ExampleECW\EXAMPLE.ecw Size is 202289, 46587 Coordinate System is: PROJCRS["GDA2020 / MGA zone 54", BASEGEOGCRS["GDA2020", DATUM["Geocentric Datum of Australia 2020", ELLIPSOID["GRS 1980",6378137,298.257222101, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",7844]], CONVERSION["UTM zone 54S", METHOD["Transverse Mercator", ID["EPSG",9807]], PARAMETER["Latitude of natural origin",0, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8801]], PARAMETER["Longitude of natural origin",141, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8802]], PARAMETER["Scale factor at natural origin",0.9996, SCALEUNIT["unity",1], ID["EPSG",8805]], PARAMETER["False easting",500000, LENGTHUNIT["metre",1], ID["EPSG",8806]], PARAMETER["False northing",10000000, LENGTHUNIT["metre",1], ID["EPSG",8807]]], CS[Cartesian,2], AXIS["easting",east, ORDER[1], LENGTHUNIT["metre",1]], AXIS["northing",north, ORDER[2], LENGTHUNIT["metre",1]], ID["EPSG",7854]] Data axis to CRS axis mapping: 1,2 Origin = (258345.518045050004730,6149669.917929629795253) Pixel Size = (0.075000000000000,-0.075000000000000) Metadata: COLORSPACE=MULTIBAND COMPRESSION_RATE_TARGET=5 VERSION=2 Corner Coordinates: Upper Left ( 258345.518, 6149669.918) (138d21'34.52"E, 34d45'59.54"S) Lower Left ( 258345.518, 6146175.893) (138d21'30.90"E, 34d47'52.85"S) Upper Right ( 273517.193, 6149669.918) (138d31'30.78"E, 34d46'12.07"S) Lower Right ( 273517.193, 6146175.893) (138d31'27.40"E, 34d48' 5.40"S) Center ( 265931.356, 6147922.905) (138d26'30.89"E, 34d47' 2.57"S) Band 1 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #0 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 2 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #1 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 3 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #2 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 4 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #3 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 5 Block=256x256 Type=Byte, ColorInterp=Alpha Description = AllOpacity Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181

This is "GDAL info" on an osgeo4w "NG" install (the one being used now to generate the new standalone installers:

C:\OSGeo4W64>gdalinfo --version GDAL 3.2.1, released 2020/12/29

C:\OSGeo4W64>gdalinfo Z:\Downloads\ExampleECW\EXAMPLE.ecw Driver: ECW/ERDAS Compressed Wavelets (SDK 5.4) Files: Z:\Downloads\ExampleECW\EXAMPLE.ecw Size is 202289, 46587 Coordinate System is: PROJCRS["GDA2020 / MGA zone 54", BASEGEOGCRS["GDA2020", DATUM["Geocentric Datum of Australia 2020", ELLIPSOID["GRS 1980",6378137,298.257222101, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",7844]], CONVERSION["UTM zone 54S", METHOD["Transverse Mercator", ID["EPSG",9807]], PARAMETER["Latitude of natural origin",0, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8801]], PARAMETER["Longitude of natural origin",141, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8802]], PARAMETER["Scale factor at natural origin",0.9996, SCALEUNIT["unity",1], ID["EPSG",8805]], PARAMETER["False easting",500000, LENGTHUNIT["metre",1], ID["EPSG",8806]], PARAMETER["False northing",10000000, LENGTHUNIT["metre",1], ID["EPSG",8807]]], CS[Cartesian,2], AXIS["easting",east, ORDER[1], LENGTHUNIT["metre",1]], AXIS["northing",north, ORDER[2], LENGTHUNIT["metre",1]], ID["EPSG",7854]] Data axis to CRS axis mapping: 1,2 Origin = (258345.518045050004730,6149669.917929629795253) Pixel Size = (0.075000000000000,-0.075000000000000) Metadata: COLORSPACE=MULTIBAND COMPRESSION_RATE_TARGET=5 VERSION=2 Corner Coordinates: Upper Left ( 258345.518, 6149669.918) (138d21'34.52"E, 34d45'59.54"S) Lower Left ( 258345.518, 6146175.893) (138d21'30.90"E, 34d47'52.85"S) Upper Right ( 273517.193, 6149669.918) (138d31'30.78"E, 34d46'12.07"S) Lower Right ( 273517.193, 6146175.893) (138d31'27.40"E, 34d48' 5.40"S) Center ( 265931.356, 6147922.905) (138d26'30.89"E, 34d47' 2.57"S) Band 1 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #0 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 2 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #1 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 3 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #2 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181 Band 4 Block=256x256 Type=Byte, ColorInterp=Undefined Description = Band #3 Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181

As you can see on with the more recent version of GDAL the transparency band is not detected.

This should be reported to GDAL (too). I'm correct @rouault ?

Or maybe in the osgeo4w and the osgeo4w-ng one are being used different ECW libraries and maybe the problem is there?

gioman commented 3 years ago

Or maybe in the osgeo4w and the osgeo4w-ng one are being used different ECW libraries and maybe the problem is there?

@jef-n forgot to tag you in the above sentence.

rouault commented 3 years ago

CC @jbowman-hexagon It would seem that ECW SDK 5.4 fails to detect the alpha band of ECW larger than 4 GB. Any idea what's going on wrong ?

agiudiceandrea commented 3 years ago

With GDAL 3.2.1 from gisinternals compiled using ERDAS ECW JPEG 2000 SDK 5.5.0 (ERDAS ECW JP2/SDK v5.5 Update 2) the alpha band is correctly recognised:

C:\Program Files\GDAL>gdalinfo EXAMPLE.ecw
Driver: ECW/ERDAS Compressed Wavelets (SDK 5.5)
Files: EXAMPLE.ecw
Size is 202289, 46587
Coordinate System is:
PROJCRS["GDA2020 / MGA zone 54",
    BASEGEOGCRS["GDA2020",
        DATUM["Geocentric Datum of Australia 2020",
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",7844]],
    CONVERSION["UTM zone 54S",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",141,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",10000000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    ID["EPSG",7854]]
Data axis to CRS axis mapping: 1,2
Origin = (258345.518045050004730,6149669.917929629795253)
Pixel Size = (0.075000000000000,-0.075000000000000)
Metadata:
  COLORSPACE=MULTIBAND
  COMPRESSION_RATE_TARGET=5
  VERSION=2
Corner Coordinates:
Upper Left  (  258345.518, 6149669.918) (138d21'34.52"E, 34d45'59.54"S)
Lower Left  (  258345.518, 6146175.893) (138d21'30.90"E, 34d47'52.85"S)
Upper Right (  273517.193, 6149669.918) (138d31'30.78"E, 34d46'12.07"S)
Lower Right (  273517.193, 6146175.893) (138d31'27.40"E, 34d48' 5.40"S)
Center      (  265931.356, 6147922.905) (138d26'30.89"E, 34d47' 2.57"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Undefined
  Description = Band #0
  Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181
Band 2 Block=256x256 Type=Byte, ColorInterp=Undefined
  Description = Band #1
  Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181
Band 3 Block=256x256 Type=Byte, ColorInterp=Undefined
  Description = Band #2
  Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181
Band 4 Block=256x256 Type=Byte, ColorInterp=Undefined
  Description = Band #3
  Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181
Band 5 Block=256x256 Type=Byte, ColorInterp=Alpha
  Description = AllOpacity
  Overviews: 101144x23293, 50572x11646, 25286x5823, 12643x2911, 6321x1455, 3160x727, 1580x363, 790x181