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, 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.tar.gz, which can be downloaded at several places. Unpack the archive. You may want to apply some patches, here and here.

patch -p0 < libecwj2-3.3-msvc90-fixes.patch
cd libecwj2-3.3/
patch -p0 < ../libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch
patch -p1 < ../libecwj2-3.3-wcharfix.patch

Then build:

sudo make install

Building gdal

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

./configure --with-ecw=/usr/local --with-python
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/ /usr/lib/

Other links