I have a set of coordinates in decimal degrees spread across two UTM zones in my Java application that I want to export to use in Petrel, so they need to be in the same UTM zone.
Is there a java library out there where I can specify what zone I want to use for the outputdata? tried quite a few libraries now and they only have utils for converting to the correct UTM zone.
Best Answer
GDAL is your best bet here. My code sample is in C++, however the Java bindings have the same essential API, so the concept will carry over.
This is code chopped from another project. The key is to create two SpatialReference objects, then set their datums. For the output, since it is in UTM, you set the UTM zone there. Normally, you pick the best utm grid zone based on the longitude, but since you need it in another, you can just manually set it to what you want.
Link to OSR Bindings http://gdal.org/java/org/gdal/osr/package-summary.html