Skip to content
Advertisement

Warp using Java GDAL API

I am trying to warp a dataset using Java GDAL API. However, GDAL Java API is not documented and it is unclear which options WarpOptions take. I feed -tr 15 15 just like for gdalwarp. This results in Option not found error:

String gdalSource = "LC81910242015182LGN00_B4.TIF";
Dataset originalData = gdal.Open(gdalSource, gdalconstConstants.GA_ReadOnly);
Vector<String> options = new Vector<>();
options.add("-tr 15 15");
WarpOptions warpOptions = new WarpOptions(options);
Dataset[] src_array = {originalData};
Dataset dataset = gdal.Warp("warp.tif", src_array, warpOptions);

What is the option to reduce/increase the resolution? Where can I get the list of possible options?

Advertisement

Answer

The available options should be the same as for gdalwarp utility.

But the options should be added like,

Vector<String> options = new Vector<>();
    options.add("-tr");
    options.add("15");
    options.add("15");

and not like you are adding them.

See, for example, this thread.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement