ECW

From OpenStreetMap Wiki
Jump to navigation Jump to search

ECW (Enhanced Compression Wavelet) is a proprietary wavelet compression image format optimized for aerial and satellite imagery. (wikipedia)

Howto install gdal with ECW support

Gdal does support the ECW format, but it is not included by default. One method is to compile the ECW plugin and gdal from source.

When in doubt, read the guide from the gdal website, but here is a summary of the process:

Building libecwj

No need to register on http://www.erdas.com, they don't seem to offer a source package for linux any longer. Instead look for the older version libecwj2-3.3-2006-09-06.zip / libecwj2-3.3-2006-09-06.tar.gz, which can be downloaded at several places. Unpack the archive. You may want to apply some patches, here and here.

wget http://mirror.ovh.net/gentoo-distfiles/distfiles/libecwj2-3.3-2006-09-06.zip
unzip libecwj2-3.3-2006-09-06.zip
wget http://trac.osgeo.org/gdal/raw-attachment/ticket/3162/libecwj2-3.3-msvc90-fixes.patch
patch -p0 < libecwj2-3.3-msvc90-fixes.patch
wget http://osgeo-org.1560.x6.nabble.com/attachment/5001530/0/libecwj2-3.3-wcharfix.patch
wget http://trac.osgeo.org/gdal/raw-attachment/ticket/3366/libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch
cd libecwj2-3.3/
patch -p0 < ../libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch
patch -p1 < ../libecwj2-3.3-wcharfix.patch

Then build:

./configure
make 
sudo make install

Building gdal

Download gdal source. If you want python support (necessary for some additional scripts that come with gdal, e.g. gdal2tiles.py), make sure you have the python development packages installed, (e.g. python-all-dev on Ubuntu).

./configure --with-ecw=/usr/local --with-python
make
sudo make install

When you get errors running gdal commands, try to manually include /usr/local/lib in LD_LIBRARY_PATH, e.g.

export LD_LIBRARY_PATH=/usr/local/lib

If you get an error for python scripts using the gdal binding, it may help to create a symbolic link as follows:

sudo ln -s /usr/lib/libproj.so.0 /usr/lib/libproj.so

Other links