2

I'm trying the gdalwrap command to set center and change the extent to -180 to 180. But for some reason, the bounding value is set but the pixel values are not transferred.

This solution not working: Changing projection from 0 360 to -180 180 for a simple raster

gdalwrap command used

gdalwarp -s_srs "+proj=longlat +datum=WGS84 +lon_wrap=180" -t_srs "+proj=longlat +datum=WGS84" -te -180 -90 180 90  world_0_360.tif world_180_180.tif -wo SOURCE_EXTRA=1000 --config CENTER_LONG 0

Before Image enter image description here

gdalifo command for before image

Size is 900, 451
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-0.200000003000000,90.200000000000003)
Pixel Size = (0.400000006788889,-0.400000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  -0.2000000,  90.2000000) (  0d12' 0.00"W, 90d12' 0.00"N)
Lower Left  (  -0.2000000, -90.2000000) (  0d12' 0.00"W, 90d12' 0.00"S)
Upper Right (     359.800,      90.200) (359d48' 0.02"E, 90d12' 0.00"N)
Lower Right (     359.800,     -90.200) (359d48' 0.02"E, 90d12' 0.00"S)
Center      ( 179.8000031,   0.0000000) (179d48' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=900x2 Type=Float32, ColorInterp=Gray
  Min=0.009 Max=3.656
  Minimum=0.009, Maximum=3.656, Mean=0.137, StdDev=0.160
  NoData Value=9.96920996838686905e+36
  Metadata:
    STATISTICS_MAXIMUM=3.6562497615814
    STATISTICS_MEAN=0.13707849099296
    STATISTICS_MINIMUM=0.00872802734375
    STATISTICS_STDDEV=0.15950693707498

After Image

enter image description here

gdalinfo for after image.

Size is 900, 450
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.400000000000000,-0.400000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"S)
Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=900x2 Type=Float32, ColorInterp=Gray
  NoData Value=9.96920996838686905e+36

The missing portion should overllay over the American region.

santhosh m
  • 117
  • 4

1 Answers1

2

Try the below command

gdalwarp -s_srs "+proj=longlat +datum=WGS84 +lon_wrap=180" -t_srs "+proj=longlat +datum=WGS84"  -te -180 -90 180 90 world_360.tif output.tif -co compress=DEFLATE

Tested on Windows and works for me.

spatialthoughts
  • 6,106
  • 28
  • 49