[gdal-dev] Q: on gdalwarp of ecw file

Stephen Woodbridge woodbri at swoodbridge.com
Mon Dec 17 13:35:08 PST 2012


On 12/17/2012 3:14 PM, Even Rouault wrote:
> Le lundi 17 décembre 2012 20:50:27, Stephen Woodbridge a écrit :
>> Hi all,
>>
>> I have an ECW file, see gdal info below.  I need to reproject this into
>> EPSG:900913 or EPSG:3857
>>
>> Do I need a key to make the output file ECW?
>
> If you use SDK 4.x, yes. With SDK 3.X if the image was < 500 MB, you didn't
> need a licence.

OK, So it looks like I have SDK 3.x:

$ gdalinfo --formats | grep ECW
   ECW (rw): ERDAS Compressed Wavelets (SDK 3.x)
   JP2ECW (rw+v): ERDAS JPEG2000 (SDK 3.x)

So this implies I have rw capabilities, but when I try:

$ gdalwarp -t_srs EPSG:900913 -of ECW Saraji_South.ecw 
Saraji_South-900913.ecw                                    Output driver 
`ECW' not recognised or does not support
direct output file creation.  The following format drivers are configured
and support direct output:
...
JP2ECW: ERDAS JPEG2000 (SDK 3.x)
...

but ECW is not in the list. Am I doing this wrong?

If I try this on my file:

ls -lh Saraji_South.ecw
-rw-r--r-- 1 woodbri woodbri 220M 2012-12-17 10:47 Saraji_South.ecw

$ gdalwarp -t_srs EPSG:900913 -of JP2ECW Saraji_South.ecw 
Saraji_South-900913.jp2
Creating output file that is 34551P x 32332L.
Processing input file Saraji_South.ecw.
0ERROR 1: ECW SDK 500MB compress limit exceeded.
ERROR 1: ECW SDK 500MB compress limit exceeded.
ERROR 1: ECW SDK 500MB compress limit exceeded.
ERROR 1: An error occured while writing a dirty block
ERROR 1: Saraji_South-900913.jp2, band 2: An error occured while writing 
a dirty block
ERROR 1: Saraji_South-900913.jp2, band 3: An error occured while writing 
a dirty block

ok, so this must mean the uncompressed file needs to be less than 500MB.

Second problem, when I try to convert it to a tif it always dies like this:

$ gdalwarp -t_srs EPSG:900913 -of GTiff -co TILED=YES -co COMPRESS=JPEG 
-co PHOTOMETRIC=YCBCR Saraji_South.ecw Saraji_South-900913.tif
Creating output file that is 34551P x 32332L.
Processing input file Saraji_South.ecw.
0...10...20..ERROR 1: Could not perform Read/Write on file

$ gdalinfo --version
GDAL 1.9.0, released 2011/12/29


Any thoughts on this?

Thanks,
   -Steve

>>
>> The performance vs size when zooming out is impressive with ECW, but it
>> does not look like I have ability to create ECW. Are there better
>> formats then GTif in the list below?
>
> JPEG2000 or MrSID are somewhat similar to ECW.
>
>>
>>
>> $ gdalwarp -t_srs EPSG:900913 -of GTiff -co TILED=YES -co COMPRESS=JPEG
>> Saraji_South.ecw Saraji_South-900913.tif
>> Creating output file that is 34551P x 32332L.
>> Processing input file Saraji_South.ecw.
>> 0...10...
>
> I'd recommand also adding -co PHOTOMETRIC=YCBCR that will make the resulting
> file typically 2 to 3 times smaller (at the expense of some quality loss of
> course)
>
> See "About JPEG compression of RGB images" section of
> http://gdal.org/frmt_gtiff.html
>
>>
>> This seems to be working, I suspect this will bulk up after I add
>> overviews.
>
> Yes, with overviews you should have good performance.
>



More information about the gdal-dev mailing list