[gdal-dev] using GDAL in a java-program
Frank Warmerdam
warmerdam at pobox.com
Fri Jan 16 12:14:00 EST 2009
Albrecht.Weiser at hzd.hessen.de wrote:
> Hi list,
> i'm developing a tool which has to convert all tiff-files in a
> directory. I'm doing it with java. The tool should create some overview
> images (image pyramid) for the tiffs like we used to do manually with
> gdaladdo before. Therefore i compiled the gdal 1.5.2 librarys with
> swig-support for java. The result was a gdal.jar that i imported to my
> project. But because of missing documentation (even no javadoc) i'm
> totally lost in using the classes. I need the similar class.method which
> does the same like the script driven gdaladdo. Example:
>
> gdaladdo -r average abc.tif 2 4 8 16
> Should be done by a java-class/method. Does anybody have a
> documentation, example or even a hint for me?
Albrecht,
The key function is GDALDataset::BuildOverviews().
http://www.gdal.org/classGDALDataset.html#2aa6f88b3bbc840a5696236af11dde15
From the Dataset.java file (in trunk - possibly matching 1.5.2) I see
this declaration:
public int BuildOverviews(String resampling, int[] overviewlist,
ProgressCallback callback) {
return gdalJNI.Dataset_BuildOverviews(swigCPtr, this, resampling,
overviewlist, callback);
}
I'm not exactly sure how to make the callback work for reporting progress.
Hopefully you can just pass null for that. There are a couple very brief
examples of Java use in gdal/swig/java/apps though they don't cover
building overviews.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list