[gdal-dev] GDAL Java Bindings and HDF4 File format

Sam Ritchie sritchie09 at gmail.com
Tue Jan 18 14:20:05 EST 2011


Hey all,

Short question first, then the longer explanation.

*QUESTION*: My java SWIG bindings, generated from source, can't read the
HDF4 format. How can I fix this?

*CONTEXT*:
I've spent the last couple of days trying to generate java bindings for gdal
that will allow me, essentially, to run this piece of java code --

https://svn.osgeo.org/fdo/tags/3.4_G032/Thirdparty/gdal/swig/java/apps/gdalinfo.java

gdal.AllRegister() works great, but I can't get past gdal.Open(), as the
bindings don't recognize HDF4.

My final goal is to create a maven package that has gdal.java and the native
dependencies bundled up together. This way, I can run jobs on NASA's MODIS
tiles on Elastic MapReduce, simply by making sure the MapReduce nodes have
gdal and hdf4 installed locally (using apt-get gdal-lib).

I built from source, using ./configure --with-hdf4=/opt/local/
--with-hdf5=/opt/local/ (macports versions). I CDed into swig, ran make,
then CDed into java, and ran make again. This gave me gdal.java, plus all of
the native dependencies as dylibs, which I moved to a directory on
java.library.path.

I wrote this piece of code to test my setup: https://gist.github.com/784850

Now, that code, as it runs now, returns this-  "(my file path)

It doesn't recognize the HDF file, even though I specified --with-hdf4.

*So, my question is,* *what special things do I need to do to get make java
swig-bindings to recognize these damn formats?* Do I have to specify
something about swig when I run ./configure initially? (BTW, I'm running on
Mac OS X, and also had to tweak the java path settings inside java.opt.

ALL I need to be able to do, really, is open up the hdf file and extract the
subdatasets. I plan on writing an article describing how to run GDAL on
Amazon's Elastic MapReduce, after I'm done with all of this stuff.

Thanks in advance, everyone!

---
Sam Ritchie
Forest Monitoring for Action
http://www.cgdev.org/section/initiatives/_active/forestmonitoringforactionforma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110118/3f2f61a7/attachment.html


More information about the gdal-dev mailing list