[gdal-dev] GDAL Java Bindings - Convert raster from [0, 360] to [-180, 180]

johie jesse.hietanen at gmail.com
Mon Jul 13 01:21:30 PDT 2015


Hi!

I'm processing some global GRIB2/netCDF data which have East-West
coordinates of 0-360 degrees. I need to have the output data on typical
-180, 180 range to process them later with some other data. When I reproject
them to WGS84 and convert to GeoTiff, the output is still 0-360. 

I found that I can then warp that output GeoTiff using the command line
gdal: gdalwarp -t_srs WGS84 input360.tif output180.tif --config CENTER_LONG
0 -wo SOURCE_EXTRA=1000

This work just fine and the output is correct. But I would need to do this
using the Java bindings. I can pass the Center Long with:
gdal.SetConfigOption("CENTER_LONG", "0"); But not the Source_Extra, which is
WarpingOptions if I understood correctly? In java there seems to be no way
to pass these warping options when using AutoCreatedWarped and Create (see
processing flow:
http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-No-data-value-using-AutoCreateWarpedVRT-td5212697.html) 

Is there some workaround to this using the Java? 

This is how the output looks when processing with the Java (Data is lost on
the white "stripe"). This looks the same as using the gdalwarp without
Source_extra.

<http://osgeo-org.1560.x6.nabble.com/file/n5215366/GDAL_CenterLong0.png> 

Thanks a lot!

Jesse





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-Convert-raster-from-0-360-to-180-180-tp5215366.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list