Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6482 closed defect (fixed)

Can't read ECW file format via VSIL API

Reported by: drons Owned by: warmerdam
Priority: normal Milestone: 2.0.3
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: ECW
Cc:

Description

I'm can't read ECW files from zip compressed file (/vsizip) or from HTTP server (/vsicurl). GDALOpen succesfully open file in RO mode, i'm can read file dimensions and metadata, but GDALDatasetRasterIO returns black picture or fails. I'm have two examples:

1.zip https://cloud.mail.ru/public/37V2/gkcC3MFYg - gdal_translate read black picture with output:

gdal_translate --debug on -of Gtiff /vsizip/./1.zip/1.ecw ./out_zip1.tif -srcwin 10000 10000 256 256

ECW: NCScbmOpenFileView(/vsizip/./1.zip/1.ecw): eErr=2, will try VSIL stream.
ECW: Got mutex.
ECW: Using filename 'C:\Users\sas\AppData\Local\Temp\3136_0.ecw' for temporary directory determination purposes.
ECW: FileInfo: SizeXY=32513,29645 Bands=3
       OriginXY=1.04475e+007,7.09934e+006  CellIncrementXY=19.1093,-19.1093
       ColorSpace=4, eCellType=0

ECW: projection=EPSG:3785, datum=EPSG:6055, units=METERS
ERROR 4: Unable to open EPSG support file gcs.csv.
Try setting the GDAL_DATA environment variable to point to the
directory containing EPSG csv files.
GDAL: GDALOpen(/vsizip/./1.zip/1.ecw, this=0000000000541450) succeeds as ECW.
GDAL: GDALDatasetCopyWholeRaster(): 256*256 swaths, bInterleave=1
ECW: RasterIO(10000,10000,256,256 -> 256x256) - doing interleaved read.
ECW: ReadBandsDirectly(-> 256x256) - reading lines directly.
GTiff: Adjusted bytes to write from 7680 to 4608.
GDAL: GDALClose(./out_zip1.tif, this=00000000031635A0)
GDAL: GDALClose(, this=0000000003160220)
GDAL: GDALClose(/vsizip/./1.zip/1.ecw, this=0000000000541450)

2.zip https://cloud.mail.ru/public/LVNm/cvnfobE13- gdal_translate failed with output:

gdal_translate --debug on -of Gtiff /vsizip/./2.zip/2.ecw ./out_zip2.tif

ECW: NCScbmOpenFileView(/vsizip/./2.zip/2.ecw): eErr=2, will try VSIL stream.
ECW: Got mutex.
ECW: Using filename 'C:\Users\sas\AppData\Local\Temp\2680_0.ecw' for temporary directory determination purposes.
ECW: FileInfo: SizeXY=4320,2160 Bands=3
       OriginXY=-180,90  CellIncrementXY=0.0833333,-0.0833333
       ColorSpace=4, eCellType=0

ECW: projection=GEODETIC, datum=WGS84, units=DEGREES
GDAL: GDALOpen(/vsizip/./2.zip/2.ecw, this=0000000000561B00) succeeds as ECW.
GDAL: GDALDatasetCopyWholeRaster(): 4320*77 swaths, bInterleave=1
ECW: RasterIO(0,0,4320,77 -> 4320x77) - doing interleaved read.
ERROR 1: Could not perform Read/Write on file
GDAL: GDALClose(./out_zip2.tif, this=0000000000569730)
GDAL: GDALClose(/vsizip/./2.zip/2.ecw, this=0000000000561B00)

gdal_info say "OK" in both cases.

When i'm try to perfom GDALDatasetRasterIO in my app from random file locations ECW library print error to stdout (seems not to be GDAL output)

160420 19:07:58 0 : NCScbmReadFileBlockLocal() File IO Error 0.
160420 19:07:58 0 : ECW::CFile::CCachedBlock ERROR: packed subband offset > packed block length

Change History (3)

comment:1 by Even Rouault, 8 years ago

Milestone: 2.0.3
Resolution: fixed
Status: newclosed

trunk r34086, branches/2.1 r34087 (post 2.1.0RC3), branches/2.0 r34088 "ECW: fix reading of ECW in /vsi file systems (with SDK >= 4) (#6482)"

comment:2 by drons, 8 years ago

Thanks! I think it's impossible to read ECW files via VSI API with SDK 3.3. Or it's requires some GDAL improvements?

comment:3 by Even Rouault, 8 years ago

Yes, it is impossible to read ECW via VSI with SDK 3.3. This is a limitation of the SDK that cannot go to the custom I/O interface for ECW files (works OK with JP2 though if I remember well)

Note: See TracTickets for help on using tickets.