[GIS] GDAL does ECW but QGIS (Linux !!) does not load ECW file

ecwgdalqgisUbuntu

Followed instructions from various posts (each one with slight variations on the theme) and most of the time have no trouble getting the installed GDAL to accept ECW files. However, QGIS refuses to accept the fact that GDAL is ECW-enabled and keeps telling me the format is not supported. As no one even mentions the fact that QGIS will NOT work even if GDAL itself does, I must be missing something really obvious somewhere (like the need to compile QGIS from source).

How to otherwise get ECW in the list of supported raster files in the qgis settings menu?

System info:

  • Virtual machines using VMWare workstation 7 on Win7 Pro.
  • LinuxMint12 (Ubuntu 11 Oneiric) with QGIS 1.7.4 upgraded to QGIS 1.8.0 and GDAL 1.9
  • Clean LinuxMint 13 (Ubuntu 12 Precise) with QGIS 1.8 and GDAL 1.9 as installed from qgis package

In all cases gdalinfo –formats list ECW as supported and commandline gdal_translate and gdalwarp work fine with ECW as input and output (translate only), but QGIS knows better and refuses to even try.

Best Answer

Sorry for late reply, had to get time free to sort it out from a brand new setup. Found out what is causing it and it has nothing to do with using the correct gdal as suggested in Answer 1 (I did run into it before as automatic updates on linux will happily upgrade the qgis-installed GDAL to 1.9.1-2~precise4 and you get that version-mismatch error).

A fresh install of QGIS 1.8.0 on a new linux mint 13 (ubuntu 12.04 precise) installs GDAL 1.7.3-6ububtu3 and that is the one against which the ECW support gets compiled. I did exactly the same as listed in my original post, and as expected the qgis-installed gdal 1.7 does support ECW while QGIS does not. Back to square one...

However, in the course of digging through tons of website pages, I did come across a post somewhere (lost which one, though) that mentions that from gdal 1.8 the location of the pluginsdirectory has changed from gdalXXplugins to gdalplugins/1.8. As QGIS 1.8.0 actually uses GDAL 1.7.3-6ubuntu3 under the hood I had ignored that info. Unfortunately, this information is not correct!! GDAL 1.7.3 also needs to have the plugin stored in the gdalplugins/1.7 folder! This is not done by the scripts so you have to do it manually. I did it by using prefixes on my last install, but it is as easy to just create the /usr/lib/gdalplugins/1.7 folder by hand and copy/move the so file from the /usr/lib/gdal17plugins folder. Done. Now QGIS 1.8.0 finds the plugin and loads ECW fine.

Hope this helps others in the same situation. Not to mention the fact that one must find the correct gdal ecw source! The 1.7.2 source is only found when you edit the repo by hand to use the old "hardy" version. If only qgis.org could keep that one file in its repo too... Sigh. Lewie