[GIS] Building GDAL with libKML support

gdalkmlogrqgis

I'm attempting to import a kml/kmz file generated using Google Tracks into my QGIS 2.4 system (built with GDAL 1.10). KML files currently lose all attributes, and as such I'm attempting to build GDAL with libKML support as I'm led to believe this will solve this issue – as per https://code.google.com/p/libkml/wiki/BuildingAndInstalling
on my Ubuntu 14.04 system.

I've successfully cloned and built the libkml library and tested it as per instructions in the wiki. I'm now trying to build gdal against the libKML library but keep failing.

I'm attempting to build against the latest SVN version as recommended here: http://www.gdal.org/drv_libkml.html

When running configure my system finds the Google KML headers but can't find the libkml library, even when I specify the path where where I built the library. For example on my system libKML was installed at /source/libkml/build

Has anyone had an experience building GDAL with this library on a linux system?

I can't seem to find any specific instructions for Ubuntu though some Fedora instructions have got me this far. As you can probably tell I'm not super confident using linux command line!

Best Answer

I clearly didn't use it at the moment but following the GDAL official Travis build configuration file should help you sort out the issue.

Just for info, this configuration file is for testing GDAL code on Ubuntu.

Trying on my computer only GDAL with kml integration, it works after below operations when testing with official example:

wget http://s3.amazonaws.com/etc-data.koordinates.com/gdal-travisci/install-libkml-r864-64bit.tar.gz
tar xzf install-libkml-r864-64bit.tar.gz
sudo cp -r install-libkml/include/* /usr/local/include
sudo cp -r install-libkml/lib/* /usr/local/lib
sudo ldconfig
wget http://download.osgeo.org/gdal/1.11.1/gdal-1.11.1.tar.gz
tar xvzf gdal-1.11.1.tar.gz
cd gdal-1.11.1
# Prefix is pointing to my empty directory to not mix with my other GDAL install
./configure --prefix=$HOME/gdal-compile --with-libkml
make
make install
ldconfig
export PATH=$HOME/gdal-compile/bin:$PATH
export LD_LIBRARY_PATH=$HOME/gdal-compile:$LD_LIBRARY_PATH
Related Question