[Gdal-dev] Trouble with ECW support

Chris Hodgson chodgson at refractions.net
Mon Jul 18 14:03:04 EDT 2005


I'm trying to get gdal working with the ERMapper ECW library. I managed 
to determine that their latest version, 3.2beta is not yet supported, so 
I switched to trying with 3.1. I was able to get the ecw library to 
compile without any particular hacks or tricks... however, in order to 
get the types to be included properly when I was compiling gdal with ecw 
support, I had to put

#define POSIX
#define LINUX

at the top of Source/include/NCSTypes.h in the ECW librray source. 
Otherwise, it when I was compiling gdal, it complained about missing 
types. I think this was the right thing to do? Anyways, it all compiles 
afterwards.

Then I compress several geotiffs into ECW using something like:

gdal_translate -of ECW -co 'TARGET=10' input.tif output.ecw

then I build a tile index of them using something like:

gdaltindex tiles *.ecw

then I use it in mapserver using something like:

   LAYER
     DEBUG ON
     NAME "ortho_collage"
     TYPE RASTER
     STATUS ON
     TILEINDEX "tiles.shp"
     TILEITEM "Location"
     PROJECTION
       "init=epsg:42102"
     END
     MAXSCALE 75000
   END

And all I can get is the standard error:

msDrawMap(): Failed to draw layer named 'ortho_collage'

gdalinfo gives the following:

Driver: ECW/ERMapper Compressed Wavelets
Size is 14610, 11308
Coordinate System is `'
Origin = (1057790.000000,515281.000000)
Pixel Size = (0.50000000,-0.50000000)
Corner Coordinates:
Upper Left  ( 1057790.000,  515281.000)
Lower Left  ( 1057790.000,  509627.000)
Upper Right ( 1065095.000,  515281.000)
Lower Right ( 1065095.000,  509627.000)
Center      ( 1061442.500,  512454.000)
Band 1 Block=14610x1 Type=Byte, ColorInterp=Gray
   Overviews: arbitrary

That's with gdal 1.2.6 - if I try with a recent cvs snapsot, I get the 
coordinate info from the .aux.xml file that gets created.

However, if I download one of the ecw files to my local computer and try 
to view it using ER Viewer, it refuses to show anything - just black, 
and it gives an error and nearly crashes if I try to zoom in.

So, it seems like just plain corrupt ECW are being created. Assuming 
this should work, I may have defined the wrong system type in the types 
header file (POSIX/LINUX) - how can I get this to work otherwise?

My system is an AMD 64-bit, which I suppose is helping to complicate 
things:
Linux dragonfly 2.6.5-1.358 #1 Sat May 8 09:01:26 EDT 2004 x86_64 x86_64 
x86_64 GNU/Linux

And I'm using a newly downloaded gcc 3.4.2:
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --with-system-zlib --enable-__cxa_atexit 
--disable-libunwind-exceptions --enable-languages=c,c++,objc,java,f77 
--enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

And I'm running fedora core 2.

Anybody have a clue for me?

Thanks in advance.

Chris



More information about the Gdal-dev mailing list