Skip to content

How to enable ECW support in GeoServer

Tisham Dhar edited this page Dec 11, 2017 · 9 revisions

Compile libecwj

We need to compile a patched version of libecwj:

wget http://www.kyngchaos.com/files/macosxport/libecwj2-3.3-2006-09-06.zip

unzip libecwj2-3.3.2006-09-06.zip

wget http://trac.osgeo.org/gdal/raw-attachment/ticket/3162/libecwj2-3.3-msvc90-fixes.patch

patch -p0 < libecwj2-3.3-msvc90-fixes.patch

wget http://osgeo-org.1560.x6.nabble.com/attachment/5001530/0/libecwj2-3.3-wcharfix.patch

wget http://trac.osgeo.org/gdal/raw-attachment/ticket/3366/libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch

cd libecwj2-3.3/

patch -p0 < ../libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch

patch -p1 < ../libecwj2-3.3-wcharfix.patch

./configure

make

make install

sudo gdal-ecw-build /usr/local

sudo ldconfig

Compile GDAL with ECW support

The commands below are for reference only, download the latest stable GDAL and compile with required drivers (including ECW above).

wget http://download.osgeo.org/gdal/gdal192.zip

unzip gdal192.zip

./configure --with-ecw=/usr/local --with-java=/usr/lib/jvm/java-7-oracle --with-python --with-static-proj4

make

make install

Compile GDAL Java bindings

SWIG 2.0 is necessary for the GDAL-JAVA bindings, ensure that this version is installed. You can obtain it from source here: https://sourceforge.net/projects/swig/files/swig/swig-2.0.12/

sudo apt-get install swig2.0

cd swig/java

make

sudo cp *.so /usr/local/lib/

sudo cp *.la /usr/local/lib/

sudo cp gdal.jar /usr/local/lib/

Install GeoServer GDAL Extension

Copy the needed jar files in the WEB-INF/lib directory to as per: http://docs.geoserver.org/stable/en/user/data/raster/gdal.html

Set the JAVA path in tomcat configuration. For Ubuntu WorldMap this can be done in /etc/init/tomcata and /etc/init/tomcatb (or in /etc/default/tomcat7 in a standard installation)

JAVA_OPTS="-Djava.library.path=/usr/local/lib/"

Still in the same configuration files we need to set the GDAL_DATA variable:

GDAL_DATA=/opt/gdal-data

Copy to /usr/local/lib also the libaries contained here: http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.12/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz

Procedure derived from: http://osgeo-org.1560.x6.nabble.com/ECW-support-on-Fedora-Linux-error-td4991388.html http://wiki.openstreetmap.org/wiki/ECW#Building_libecwj