[gdal-dev] Matching two datasets...

Jonathan Greenberg jgrn at illinois.edu
Thu Jul 12 10:38:07 PDT 2012


GDALers:

Hope this isn't too much of a noobish question.  Given two images, A
and B, I want to have B match A in terms of projection, extent, and
resolution such that A and B will stack perfectly.  The tricky part
here, and one I'm not sure how to solve is that while they are both
global datasets with the same projection and datum, the origin of
image A is at -180 long and image B is ~0 long, so B needs to be
"rotated" halfway around the world to properly line up with A.

Suggestions for solving this?  Thanks!  GDALINFO below.  I can drop
one of the two files in a dropbox if need be, and the other one comes
from the Worldclim website (its too big for me to share up here).

--j

IMAGE A:

C:\release-1600-x64-gdal-mapserver>gdalinfo P:\global_boundary\raster\climate\nc
ep\elevation_raw.envi
Driver: ENVI/ENVI .hdr Labelled
Files: P:\global_boundary\raster\climate\ncep\elevation_raw.envi
       P:\global_boundary\raster\climate\ncep\elevation_raw.envi.aux.xml
       P:\global_boundary\raster\climate\ncep\elevation_raw.hdr
Size is 43200, 18000
Coordinate System is:
GEOGCS["GCS_WGS_1984",
    DATUM["unknown",
        SPHEROID["WGS84",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.008333333333333,-0.008333333333333)
Metadata:
  Band_1=Band 1
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, -60.0000000) (180d 0' 0.00"W, 60d 0' 0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
Lower Right ( 180.0000000, -60.0000000) (180d 0' 0.00"E, 60d 0' 0.00"S)
Center      (  -0.0000000,  15.0000000) (  0d 0' 0.00"W, 15d 0' 0.00"N)
Band 1 Block=43200x1 Type=Float32, ColorInterp=Undefined
  Min=-431.000 Max=8233.000
  Minimum=-431.000, Maximum=8233.000, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=8233
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=-431
    STATISTICS_STDDEV=0

***

IMAGE B:
C:\release-1600-x64-gdal-mapserver>gdalinfo P:\global_boundary\raster\climate\nc
ep\wnd_raw.envi
Driver: ENVI/ENVI .hdr Labelled
Files: P:\global_boundary\raster\climate\ncep\wnd_raw.envi
       P:\global_boundary\raster\climate\ncep\wnd_raw.envi.aux.xml
       P:\global_boundary\raster\climate\ncep\wnd_raw.hdr
Size is 192, 94
Coordinate System is:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_84",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]
Origin = (-0.937500000000000,89.494064331054702)
Pixel Size = (1.875000000000000,-1.904129028320310)
Metadata:
  Band_10=Band 10
  Band_11=Band 11
  Band_12=Band 12
  Band_1=Band 1
  Band_2=Band 2
  Band_3=Band 3
  Band_4=Band 4
  Band_5=Band 5
  Band_6=Band 6
  Band_7=Band 7
  Band_8=Band 8
  Band_9=Band 9
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  -0.9375000,  89.4940643) (  0d56'15.00"W, 89d29'38.63"N)
Lower Left  (  -0.9375000, -89.4940643) (  0d56'15.00"W, 89d29'38.63"S)
Upper Right (     359.063,      89.494) (359d 3'45.00"E, 89d29'38.63"N)
Lower Right (     359.063,     -89.494) (359d 3'45.00"E, 89d29'38.63"S)
Center      ( 179.0625000,   0.0000000) (179d 3'45.00"E,  0d 0' 0.00"N)
Band 1 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.269 Max=13.755
  Minimum=0.269, Maximum=13.755, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=13.755012512207
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.26909247040749
    STATISTICS_STDDEV=0
Band 2 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.307 Max=13.714
  Minimum=0.307, Maximum=13.714, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=13.713808059692
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.30690503120422
    STATISTICS_STDDEV=0
Band 3 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.283 Max=13.383
  Minimum=0.283, Maximum=13.383, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=13.382827758789
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.28258854150772
    STATISTICS_STDDEV=0
Band 4 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.286 Max=14.461
  Minimum=0.286, Maximum=14.461, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=14.460576057434
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.28578454256058
    STATISTICS_STDDEV=0
Band 5 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.301 Max=14.373
  Minimum=0.301, Maximum=14.373, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=14.373078346252
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.30080729722977
    STATISTICS_STDDEV=0
Band 6 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.293 Max=14.635
  Minimum=0.293, Maximum=14.635, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=14.634740829468
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.29314732551575
    STATISTICS_STDDEV=0
Band 7 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.308 Max=14.486
  Minimum=0.308, Maximum=14.486, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=14.485512733459
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.30756038427353
    STATISTICS_STDDEV=0
Band 8 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.280 Max=15.288
  Minimum=0.280, Maximum=15.288, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=15.288056373596
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.28006967902184
    STATISTICS_STDDEV=0
Band 9 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.278 Max=14.957
  Minimum=0.278, Maximum=14.957, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=14.956644058228
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.27797880768776
    STATISTICS_STDDEV=0
Band 10 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.266 Max=13.162
  Minimum=0.266, Maximum=13.162, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=13.16206073761
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.26645627617836
    STATISTICS_STDDEV=0
Band 11 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.264 Max=12.027
  Minimum=0.264, Maximum=12.027, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=12.027455329895
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.26428005099297
    STATISTICS_STDDEV=0
Band 12 Block=192x1 Type=Float32, ColorInterp=Undefined
  Min=0.254 Max=12.724
  Minimum=0.254, Maximum=12.724, Mean=0.000, StdDev=0.000
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=12.723794937134
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0.25427594780922
    STATISTICS_STDDEV=0

-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
http://www.geog.illinois.edu/people/JonathanGreenberg.html


More information about the gdal-dev mailing list