Skip to content

Building KEA on Ubuntu

Sam Gillingham edited this page Mar 24, 2022 · 2 revisions

Building libkea on Ubuntu

Build libkea for use with GDAL can be achieved in 2 ways:

  1. Build libkea then (re)build GDAL with KEA support using the internal KEA driver
  2. Build libkea with the bundled GDAL KEA plugin driver

Option (1) is preferred since the GDAL internal KEA driver is better maintained and has more features than the bundled KEA plugin driver. However the plugin driver does support a wide range of GDAL versions (back to version 2) and is the only choice when you can't rebuild GDAL for whatever reason.

Building libkea

libkea needs to be compiled from source so we need to install the necessary tools to compile software from source along with the HDF5 libraries and headers:

sudo apt-get install git build-essential cmake libhdf5-dev

We can then get the source directly from the public code repository:

cd /tmp
git clone https://github.com/ubarsc/kealib.git
cd kealib
mkdir build && cd build
cmake ..

Ensure all the required dependencies are found then run:

make
sudo make install

For access from GDAL either recompile GDAL with the appropriate flags or build as a plugin (below)

Building the KEA GDAL plugin

first of all, we need an installation of GDAL on the system. To install both the C++ library and the command line utilities along with the headers for building:

sudo apt-get install libgdal-dev gdal-bin libhdf5-dev
sudo apt-get install git build-essential cmake

We can then get the source directly from the public code repository:

cd /tmp
git clone https://github.com/ubarsc/kealib.git
cd kealib
mkdir build && cd build
cmake -D LIBKEA_WITH_GDAL ..

Ensure all the required dependencies are found then run:

make
sudo make install

The KEA plugin can then be linked with the other GDAL plugins. To do so, put the following lines at the end of your ~/.bashrc file:

export GDAL_DRIVER_PATH=/usr/local/lib/gdalplugins

Then reload your bashrc:

source ~/.bashrc

To install for all users on the machine: On Ubuntu, you can use the /etc/environment file instead of ~/.bashrc. Other distributions might use /etc/profile.

Test the install

you@yourlinuxbox:/usr/local/src/kealib/trunk$ gdalinfo --formats | grep KEA
  KEA (rw+): KEA Image Format (.kea)