[gdal-dev] GDAL and OGR utilities as library functions?
Referencing this blog posthttp://erouault.blogspot.com/2015/10/gdal-and-ogr-utilities-as-library.html I need to use the "new" Translate method in the GDAL Java API. However, the Translate method is not even in GDAL2.1.0 available at Maven (TranslateOptions is in there, but not Translate). The Windoze versions of GDAL available at GISInternals also do not seem to have the Translate method, although I did find one version that has it, I've added it to an IntelliJ project as a library.
Question1: Is it "supposed" to be available at this time?
There is little/no documentation on how to use the Translate method. I'm guessing here, but the way I'm trying to use it is:
The input dataset (ds) is a GeoTiff, I'm just trying to create a .png thumbnail. The call to Translate does indeed write a translateTest.png file to disk, but it's just the original geotiff - renamed, not a .png, and not re-sized.
I do not know what the "arguments" in the optionsVector are supposed to be (It does throw an exception if I put in -of PNG, it doesn't like the hyphen), and I've also tried "one per add" (.add("of"), .add("PNG"))
Question2: If this thing is supposed to be ready for prime-time, what is the TranslateOptions object supposed to contain? What is the correct way to populate it and what are valid "arguments"?
Even, thanks for the prompt response. Your example is indeed correct and worked just fine.
Still having some problems with Windows GDAL version mismatches (the dreaded SwigUpcast exception), and not all versions of the Windows gdal.jar have the Translate method, but I'll get with Gisinternals to see what's going on with that.