[Gdal-dev] gdal_translate & srcwin
Charlton Purvis
cpurvis at asg.sc.edu
Mon Aug 16 14:14:23 EDT 2004
Hi, folks:
(I've mentioned attachments in this email, but I've put them in this dir instead of on this post. They are here: http://nautilus.baruch.sc.edu/~cpurvis/gdal.)
Just starting to dabble w/ GDAL, and I've probably got an obscenely naïve question for the group.
My file's info . . .
gdalinfo HDF4_EOS:EOS_GRID:"dem30ARC_E60N0.hdf":demGRID:LandWater
Driver: HDF4Image/HDF4 Dataset
Size is 14400, 10800
Coordinate System is:
GEOGCS["Unknown datum based upon the Clarke 1866 ellipsoid",
DATUM["Not specified (based on Clarke 1866 spheroid)",
SPHEROID["Clarke 1866",6378206.4,294.9786982138982,
AUTHORITY["EPSG","7008"]]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
Origin = (60000000.000000,0.000000)
Pixel Size = (8333.33333333,-8333.33333333)
Corner Coordinates:
Upper Left (60000000.000, 0.000) (60000000d 0'214748364800.00"E, 0d 0'0.01"N)
Lower Left (60000000.000,-90000000.000) (60000000d 0'214748364800.00"E,90000000d 0'322122547200.00"S)
Upper Right (180000000.000, 0.000) (180000000d 0'648540061696.00"E, 0d 0'0.01"N)
Lower Right (180000000.000,-90000000.000) (180000000d 0'648540061696.00"E,90000000d 0'322122547200.00"S)
Center (120000000.000,-45000000.000) (120000000d 0'433791696896.00"E,45000000d 0'163208757248.00"S)
Band 1 Block=14400x1 Type=Byte, ColorInterp=Gray
If I do a straight gdal_translate of the above HDF in its entirety with a
gdal_translate -of GTiff \
HDF4_EOS:EOS_GRID:"dem30ARC_E60N0.hdf":demGRID:LandWater \
purvis.tif
I'll get something like the attached full_shot.png. Not very glamorous, but so far so good.
Now what I want to do is to take a small sample of the data and produce an image. So I was thinking that something like
gdal_translate -of GTiff \
HDF4_EOS:EOS_GRID:"dem30ARC_E60N0.hdf":demGRI D:LandWater \
-srcwin 7200 0 1000 1000 purvis2.tif
would give me a 1000x1000 .tif beginning at pixel 7200,0 (didn't see any units for srcwin parameters in the docs).
Well, I do get what appears to be the correct region, but why is my data 'gone', i.e. only a region w/ one value (highlighted in only red, because they all come back value = 0)? See subsample_shot.png.
Thanks,
Charlton
Charlton Purvis
(803) 777-8858 : voice
(803) 777-3935 : fax
cpurvis at sc.edu
Baruch Institute
University of South Carolina
Columbia, SC 29208
More information about the Gdal-dev
mailing list