Wednesday 30 May 2018

qgis - Unable to install ECW support on lubuntu 14.04


I try unsuccessfully to install the ECW support (mainly to use ECW file in QGIS 2.2). We attempt to follow and adapt the howto provided by makina-corpus. My first supprise was the repository ubuntugis-unstable is unavailable for trusty and the repository http://qgis.org/debian doesn't have libgdal-ecw-src package. Finally in desperation we add ubuntugis-unstable for the raring distribution in source.list.


And apply the following commands



chmod +x ERDAS-ECW_JPEG_2000_SDK-5.1.1.bin
./ERDAS-ECW_JPEG_2000_SDK-5.1.1.bin # Select option desktop read only
sudo cp -r ERDAS-ECW_JPEG_2000_SDK-5.1.1 /usr/local/
sudo ln -s /usr/local/ERDAS-ECW_JPEG_2000_SDK-5.1.1/Desktop_Read-Only/lib/x86/release/libNCSEcw.so /usr/local/lib/libNCSEcw.so
sudo ldconfig
sudo apt-get install libgdal-ecw-src
sudo gdal-ecw-build /usr/local/ERDAS-ECW_JPEG_2000_SDK-5.1.1/Desktop_Read-Only

The ECW format seems to be installed


gdalinfo --formats | grep -i ecw

ECW (rw+): ERDAS Compressed Wavelets (SDK 5.1)
JP2ECW (rw+v): ERDAS JPEG2000 (SDK 5.1)

But .... Gis crash when a ECW raster file is open with the following message :


QGIS died on signal 4Abandon (core dumped)

If anyone have an idea



Answer



By now, ubuntugis-unstable has added trusty packages for QGIS 2.2 and GDAL 1.11. Unfortunately, libgdal-ecw-src is still missing, and the available versions for raring and precise are intended for GDAL 1.10.


However, I got it working (with some help from the qgis user mailing list):




  1. Add ubuntugis-unstable for trusty to the sources list, or Ubuntu Software center

  2. Install QGIS 2.2, GDAL 1.11 and libgdal-dev

  3. Make sure QGIS is working

  4. Download the ERDAS ECW SDK 5.1 for Linux from http://download.intergraph.com/

  5. Open a terminal window and enter



chmod +x ECWJP2SDKSetup_5.1.1.bin
./ECWJP2SDKSetup_5.1.1.bin #Select desktop-read-only and accept the license)

sudo cp -r ERDAS-ECW_JPEG_2000_SDK-5.1.1 /usr/local/
sudo ln -s /usr/local/ERDAS-ECW_JPEG_2000_SDK-5.1.1/Desktop_Read-Only/lib/x64/release/libNCSEcw.so /usr/local/lib/libNCSEcw.so
sudo ldconfig

To avoid version conflicts, we do not install libgdal-ecw-src with apt-get, but fetch it manually and extract it:



wget https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable/+files/libgdal-ecw-src_1.10.0-1~precise4_all.deb
ar vx libgdal-ecw-src_1.10.0-1~precise4_all.deb
tar -xzf data.tar.gz
sudo cp usr/src/libgdal-ecw-1.10.0.tar.gz /usr/src/

sudo cp usr/bin/gdal-ecw-build /usr/bin/
sudo gdal-ecw-build /usr/local/ERDAS-ECW_JPEG_2000_SDK-5.1.1/Desktop_Read-Only

GDAL from ubuntugis is 1.11, but the script stores the plugin into /usr/lib/gdalplugins/1.10, hence it is not found by gdalinfo.


So I created a subfolder 1.11 and copied the .so file into it:



 sudo mkdir /usr/lib/gdalplugins/1.11
cd /usr/lib/gdalplugins/1.10
cp gdal_ECW_JP2ECW.so /usr/lib/gdalplugins/1.11


Now you can run:



 gdalinfo --formats | grep -i ECW 
ECW (rw+): ERDAS Compressed Wavelets (SDK 5.1)
JP2ECW (rw+v): ERDAS JPEG2000 (SDK 5.1)

The SDK folder has a testdata subfolder with some samples, which should work with QGIS (also on Windows and Ubuntu 12.04).




UPDATE 09-2015


It seems that my workaround does not work with newer versions of ubuntu. There is no gdal package yet available at ubuntugis for vivid (15.04). Utopic (14.10) might be the latest to work, but I have not tested it.





UPDATE 02-2019


For Ubuntu 16.04 and newer, you might follow How to get ECW support on QGIS 2.16 - Ubuntu 16.04? and Can't install support for ECW in QGIS 3.6 / 3.4 on Ubuntu 18.04


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...