6

I know there are similar questions here, but I've tried every answer and every tutorial I could find, and I still can't open ECW with QGIS (and I kind of broke my qgis install? When I try to install QGIS I have dependancy errors for qgis-providers, qgis-plugin-grass and python-qgis now). I use Ubuntu 20.04 and QGIS 3.24.1.

I compiled GDAL with ECW support, which seems to work fine as gdalinfo --formats | grep ECW gives

ECW -raster- (rw+): ERDAS Compressed Wavelets (SDK 5.4)
JP2ECW -raster,vector- (rw+v): ERDAS JPEG2000 (SDK 5.4)

But I don't know how to make QGIS use the version that I compiled. gdalinfo --version gives me GDAL 2.3.2, released 2018/09/21 but when I go to the QGIS details it says QGIS is using GDAL 3.0.4. I also tried one of the tutorials from a clean Ubuntu install (on a virtual box) and it still didn't work. I don't know what I'm doing wrong but I'm not really used to dealing with these kinds of things so potentially I am doing some things wrong. I also read somewhere that I should try to compile QGIS with my GDAL install but I have no idea how to do that.

0

2 Answers 2

8

Compiling GDAL using proprietary library to support ECW file format - Ubuntu

QGIS uses GDAL for file formats.

1. UPDATE -
  • Download zip file from here for 5.4.0
  • Downlaod the latest version from hexagon site
unzip ERDAS_ECWJP2_SDK-5.4.0.bin.zip
chmod +x ./ERDAS_ECWJP2_SDK-5.4.0.bin
2. Run bin - Choose Option 1. Desktop_Read-Only

./ERDAS_ECWJP2_SDK-5.4.0.bin

3. Copy installed files to /usr/local/hexagon_ecw
sudo mkdir -p /usr/local/hexagon_ecw
sudo cp -r hexagon/ERDAS-ECW_JPEG_2000_SDK-5.4.0/Desktop_Read-Only/* /usr/local/hexagon_ecw
4. Make symbolic link to libs like libNCSEcw.so.**
sudo ln -s /usr/local/hexagon_ecw/lib/x64/release/* /usr/local/lib/
5. Download and install proper PROJ version

Get PROJ version from Help->About Mine is 6.3.1

Download from https://github.com/OSGeo/PROJ/releases.

tar -xvf proj-6.3.1.tar.gz
cd proj-6.3.1
mkdir build 
cd build
cmake .. # had to install libsqlite3-dev dependency
make -j$(nproc)
sudo make install
6. Downlad GDAL for specific QGIS version

Get GDAL version from Help->About QGIS 3.26.3 uses gdal 3.0.4

Download from http://download.osgeo.org/gdal

tar -xvzf gdal-3.0.4.tar.gz
cd gdal-3.0.4
./configure --with-ecw=/usr/local/hexagon_ecw
make -j$(nproc) # Compile takes a lot of time... 
sudo make install

If you get errors on make above, use this bellow before the make command above (from here)

export LD_LIBRARY_PATH=//usr/local/hexagon_ecw/lib/cpp11abi/x64/release:$LD_LIBRARY_PATH
7. Set env. variables
echo 'export LD_LIBRARY_PATH=/usr/local/lib' >> ~/.profile
echo 'export LD_LIBRARY_PATH=/usr/local/lib' >> ~/.bashrc
GDAL_DATA="/usr/local/share/gdal"
ldconfig
8. Check if ECW is installed

gdalinfo --formats | grep ECW

Based and updated from here.

Tested on Ubuntu 22.04 and 20.04

6
  • 1
    In my case, cmake .. comand finish with sqlite3, libtiff and curl libraries not found errors. So I have to do: sudo apt-get install libsqlite3-dev libtiff-dev libcurl4-openssl-dev
    – Pin
    Commented Oct 16, 2022 at 10:30
  • 2
    Then "./configure --with-ecw=/usr/local/Desktop_Read-Only" finish with "error: PROJ 6 symbols not found" so need to do sudo apt-get install libproj-dev
    – Pin
    Commented Oct 16, 2022 at 10:53
  • Hi, I did the same as you said but it didn't work for me.gdalinfo --formats | grep ECW shows nothing and I can't open ECW Map inside QGIS.
    – Parisa.H.R
    Commented Aug 18, 2023 at 15:13
  • @imbr thanks for your response, I wonder that I have no problem in QGIS in windows but in Linux they didn't support ECW and they didn't provide any solution. I will be appreciated if tell me too as soon as find it.
    – Parisa.H.R
    Commented Aug 18, 2023 at 21:26
  • 1
    Newer gdal releases no longer ship with ./configure so the above instructions aren't working (tested with gdal 3.7.0), and I can't find a download link for the 5.4.0 ERDAS ECW JP2 SDK (only 5.5.0 is available at the linked download page)
    – Max Ogden
    Commented Aug 24, 2023 at 18:15
1

Answer from comments and Can't install support for ECW in QGIS 3.6 / 3.4 on Ubuntu 18.04:

You have to compile the same GDAL version used by QGIS with ECW support manually to use ECW inside QGIS.

1
  • Hi, how find out which version to use I don't know which version of GDAL is used in ECWJP2SDKSetup_5.5.0.2268-Update4-Linux and QGIS 3.22.4.
    – Parisa.H.R
    Commented Aug 17, 2023 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.