<div dir="ltr">Jesse,<div> The problem with warping is that you might incur resampling. Here is an older thread, no longer exists beside in the wayback machine, which explains how you can swap sides using pixel tricks in a VRT header (pointing to your original data). </div><div><a href="https://web.archive.org/web/20130618003511/http:/www1.eonfusion.com/manual/index.php/Manipulate_rasters_with_GDAL_VRT">https://web.archive.org/web/20130618003511/http:/www1.eonfusion.com/manual/index.php/Manipulate_rasters_with_GDAL_VRT</a><br></div><div><br></div><div>It should be fairly easy to script up something to do this general also. I use this trick to no only swap from 180 to 360 but also support WMS layers from -180 to 360 (540 degrees total) without duplicating data. That way WMS clients can call either ranges from -180 to 180 or 0 to 360.</div><div><br></div><div>Regards,</div><div>Trent</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 13, 2015 at 1:21 AM, johie <span dir="ltr"><<a href="mailto:jesse.hietanen@gmail.com" target="_blank">jesse.hietanen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<br>
<br>
I'm processing some global GRIB2/netCDF data which have East-West<br>
coordinates of 0-360 degrees. I need to have the output data on typical<br>
-180, 180 range to process them later with some other data. When I reproject<br>
them to WGS84 and convert to GeoTiff, the output is still 0-360.<br>
<br>
I found that I can then warp that output GeoTiff using the command line<br>
gdal: gdalwarp -t_srs WGS84 input360.tif output180.tif --config CENTER_LONG<br>
0 -wo SOURCE_EXTRA=1000<br>
<br>
This work just fine and the output is correct. But I would need to do this<br>
using the Java bindings. I can pass the Center Long with:<br>
gdal.SetConfigOption("CENTER_LONG", "0"); But not the Source_Extra, which is<br>
WarpingOptions if I understood correctly? In java there seems to be no way<br>
to pass these warping options when using AutoCreatedWarped and Create (see<br>
processing flow:<br>
<a href="http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-No-data-value-using-AutoCreateWarpedVRT-td5212697.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-No-data-value-using-AutoCreateWarpedVRT-td5212697.html</a>)<br>
<br>
Is there some workaround to this using the Java?<br>
<br>
This is how the output looks when processing with the Java (Data is lost on<br>
the white "stripe"). This looks the same as using the gdalwarp without<br>
Source_extra.<br>
<br>
<<a href="http://osgeo-org.1560.x6.nabble.com/file/n5215366/GDAL_CenterLong0.png" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/file/n5215366/GDAL_CenterLong0.png</a>><br>
<br>
Thanks a lot!<br>
<br>
Jesse<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-Convert-raster-from-0-360-to-180-180-tp5215366.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-Convert-raster-from-0-360-to-180-180-tp5215366.html</a><br>
Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br></div>