1

Since GDAL 2.1 GDAL and OGR utilities can be used as library functions, so this task is incredibly simple now:

from osgeo import gdal

ds = gdal.Open('original.tif')
ds = gdal.Translate('new.tif', ds, projWin = [-75.3, 5.5, -73.5, 3.7])
ds = None

Is there a similar library in Java to replace gdal_translate.exe call?

1 Answer 1

1

Yes there is. you can call the same using GDAL Java bindings.

Official documentation can be found at this link

For downloading it using maven you can find maven repo link here

You can find details of translate function here

You can use translate function in two ways

public static Dataset Translate​(java.lang.String dest,
                            Dataset dataset,
                            TranslateOptions translateOptions,
                            ProgressCallback callback)

and

public static Dataset Translate​(java.lang.String dest,
                            Dataset dataset,
                            TranslateOptions translateOptions)
1
  • 2
    I have gone through this documentation but as a newbie to GDAL unable to figure out how to use it. An example will be great!!! @user4906240
    – getsuha
    Commented May 30, 2019 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.