2

I'm trying to convert a raster with projections of (0, 360) to (-180, 180), and I've tried various SO solutions such as this, but it gave me a cropped output that doesn't have the western hemisphere.

The exact command that I've used is:

gdalwarp -t_srs EPSG:4326 -te -180 -90 180 90 prec_high_res.tif rec_high_res2.tif

Does anyone have any idea how to resolve this?

  • Looks like you are missing --config CENTER_LONG 0 – snowman2 Jan 21 at 21:22
  • Nope, gives the exact same thing – Ali Abbas Jan 21 at 21:23
  • That's fine, thanks! (btw, do you know the answer to this question?) – Ali Abbas Jan 21 at 22:41
  • you can have a look at this solution? – Raskar Kapak Jan 21 at 23:57
1

As you can see in following image, I have loaded in QGIS 3 a raster (world_0_360.tif) with longitudes from 0 360 and with latitudes from -90 90.

enter image description here

Afterward, I tried out an equivalent command used in accepted answer in your link:

gdalwarp -t_srs WGS84 world_0_360.tif world_180.tif  -wo SOURCE_EXTRA=1000 --config CENTER_LONG 0

and it ran without any error:

Using band 4 of source image as alpha. Creating output file that is 2048P x 1024L. Processing world_0_360.tif [1/1] : 0...10...20...30...40...50...60...70...80...90...100 - done.

After running above command, I also loaded resulting raster (world_180.tif) in QGIS. I assigned 50 % of transparency for both raster and it can be observed in following image that they match almost perfectly. So, @Frank Warmerdam procedure produces a good and reproducible result.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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