-
Notifications
You must be signed in to change notification settings - Fork 1
GDAL Java Bindings
eightysteele edited this page Jun 28, 2012
·
2 revisions
Gulo, the VertNet harvester, uses Cascalog for running MapReduce queries, and we need Java GDAL bindings, so they need to be built. Here are the steps for Ubuntu.
Before building, we'll need PROJ4 for reprojection support, so let's get that installed first:
$ curl -O http://download.osgeo.org/proj/proj-4.8.0.tar.gz
$ tar xvfz proj-4.8.0.tar.gz
$ cd proj-4.8.0
$ ./configure
$ make
$ sudo make install
That installs the native libraries in /usr/local/lib/libproj*
. Now we're ready for GDAL! Buuut, if you see any unexpected errors, try a sudo apt-get install proj4
.
First download, configure, and make GDAL:
$ curl -O http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
$ tar xvfz gdal-1.9.1.tar.gz
$ cd gdal-1.9.1
$ ./configure --with-static-proj4=/usr/local --with-java=yes
$ make
Next edit gdal-1.9.1/swig/java/java.opt
with your JAVA_HOME
path:
JAVA_HOME = "/usr/lib/jvm/java-6-openjdk-amd64"
JAVADOC=$(JAVA_HOME)/bin/javadoc
JAVAC=$(JAVA_HOME)/bin/javac
JAVA=$(JAVA_HOME)/bin/java
JAR=$(JAVA_HOME)/bin/jar
JAVA_INCLUDE=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Almost there! Just make it:
$ cd gdal-1.9.1/swig/java/
$ make
And finally copy the resulting .so
files into a directory and update your LD_LIBRARY_PATH
environment variable to point to them:
$ cd /gdal-1.9.1/swig/java
$ ls | grep .so
libgdalconstjni.so
libgdaljni.so
libogrjni.so
libosrjni.so
$ cp *.so ~/opt/linuxnative/
$ export LD_LIBRARY_PATH=~/opt/linuxnative/ # Put this in .bashrc