Adding ECW support to GDAL via plugins.

Posted by – Sunday 2011-02-27

In this post we will see how to add to the Geospatial Data Abstraction Library [1] (GDAL) library limited support [note 1] for ER Mapper’s Enhanced Compression Wavelet (ECW) format[2]. The environment will be an Ubuntu Linux operating system.

The ECW format has become very popular because it achieves high compression ratios at the expense of small amounts of RAM memory and computing time. Another remarkable feature of this format is selective decompression, that is, it is “able to selectively decompress a portion of digital imagery while viewing the image, and to selectively decompress the image at different levels of detail (as the user zooms in or out the image view)” [3]. Other popular compression formats like TIFF or JPEG do not feature selective decompression; the whole image must be decompressed before viewing it, a seriuos issue when working with gigabyte sized images like orthophotographs.

The ECW format is propietary and, thus Linux distros like Debian or Ubuntu do not provide support for ECW in GDAL, even in their selections of non-free packages. That is the reason of the ‘install recipes’ shown in this post.

In the first section we will see how to compile this library, creating a .deb package useful for future installations. In the second section we will see how to install the GDAL’s ECW plugin, also needed to get GDAL able to read ECW files.

Come abilitare il supporto ai file ECW in GDAL e visualizzarli in GRASS e QGIS“, written in Italian language, is the article this one is based on.

1. Installing ER Mappers’ ECW library

Some years ago, the “ECW JPEG 2000 SDK” was available for download at the ERDAS, Inc. web page. It was provided in a zipped file named ‘’. After moving the download location, it seems it has dissappared [note 2]. Thus, you will have to search it. As it is said in Spain, “Recuerda, Google es tu amigo.

Once you have downloaded the file, follow these steps:

  • $ unzip libecwj2-3.3 (in your $HOME; do not forget reading the license agreement!)
  • $ cd $HOME/libecwj2-3.3/
  • $ sudo ./configure –prefix=/usr/local [note 3]
  • $ sudo make
  • $ sudo make install
  • $ sudo checkinstall [note 4, 5]

Once these steps are completed, the deb package libecwj2_3.3-1_i386.deb will have been created and saved in the directory $HOME/libecwj2-3.3/, so it can be used for future installations, avoiding recompilation. In addition, it will also be installed.

2. Installing the GDAL plugin for ECW

Now, let’s install the GDAL plugin for ECW. First, we have to download de source code:

  • $ cd /tmp/
  • $ sudo svn export svn:// gdal-ecw [note 6]

Before continuing, check that the version of the downloaded source code matches the version of the gdal library (package). In my case, gdal library and ECW plugin versions were, respectively 1-1.6.0 and 1.6.1.

Next, compile and install the plugin:

  • $ cd /tmp/gdal-ecw/
  • $ sudo fakeroot debian/rules binary-indep [note 7, 8]
  • $ sudo dpkg –install /tmp/gdal-ecw-src_1.6.1-1_all.deb [note 9]
  • $ cd /usr/src/
  • $ sudo gzip -d gdal-ecw-1.6.1.tar.gz
  • $ sudo tar -xf gdal-ecw-1.6.1.tar
  • $ cd /usr/src/gdal-ecw-1.6.1/
  • $ sudo ./configure –with-ecw=/usr/local/ –with-autoload=/usr/lib/gdal16plugins
  • $ sudo make
  • $ sudo make install [note 10]

The last step is checking that GDAL now has support for the ECW format:

$ gdalinfo --formats | grep ECW [note 11]

An output like

ECW (rw): ERMapper Compressed Wavelets
JP2ECW (rw+): ERMapper JPEG2000

is an indication of success.


[note 1] According to the license agreement, “You may install and use the enclosed ECW JPEG 2000 SDK with Unlimited Decompression and Limited Compression (Less than 500MB)”.

[note 2] source: ECW plugin for GDAL

[note 3] Before execution, check that the package build-essential is already installed.

[note 4] Before execution, check that the package checkinstall is already installed.

[note 5] You will be asked for a description of the package, maintainer’s name and e-mail address, architecture, license…

[note 6] Before execution, check that the package subversion is already installed.

[note 7] Before execution, check that the package debhelper is already installed. If not, you will get an error message like this one:

make: dh_testdir: Command not found
make: *** [untar-stamp] Error 127

[note 8] In case you get an error message like “/usr/bin/fakeroot: line 176: debian/rules: Permission denied”, set the file debian/rules to executable, that is:

$ sudo chmod +x debian/rules

It seems a bug (

[note 9] Before execution, check that the package libgdal1-dev is already installed.

[note 10] On success, the file /usr/lib/gdal16plugins/ will be created.

[note 11] Before execution, check that the package gdal-bin is already installed.


[1] Geospatial Data Abstraction Library, web page:

[2] ECW file format, Wikipedia entry:

[3] “Wavelet based ECW image compression”, Christoph Ueffing Merzhausen:

4 Comments on Adding ECW support to GDAL via plugins.


  1. gil says:

    Hello, and thank you.
    The all process finished ok, without errors, but after $ gdalinfo –formats | grep ECW nothing happens, and Grass not recognized my .ecw files.
    Any idea?

    Ubuntu 10.10


  2. Kelson says:

    To “download” the correct version for this sample, i’ve just found that the libgdal-ecw-1.6.1.tar.gz is associated with the revision 2287. So, try “svn export -r 2287 svn:// gdal-ecw”.