[Gdal-dev] problem of gdal_translate 1.1.9 and 1.2.1 with multiple bands

Xiaodong Zhang zhang at aero.und.edu
Tue Jul 27 23:59:38 EDT 2004


Hi,

I have tried both gdal 1.1.9 and 1.2.1, but it seemed that for both versions,
gdal_translate can only return one band after subsetting a multiband image.

For example,

gdalinfo /mnt/dngp_images/3328_092002.tif, would retrun the following
------------------------------------------
Driver: GTiff/GeoTIFF
Size is 7450, 7092
Coordinate System is:
PROJCS["WGS 84 / UTM zone 13N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235629972,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree (supplier to define representation)",0.01745329251994328],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-105],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32613"]]
Origin = (593925.000000,5207115.000000)
Pixel Size = (30.00000000,-30.00000000)
Metadata:
  TIFFTAG_SOFTWARE=IMAGINE TIFF Support
Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved
@(#)$RCSfile: etif.c $ $Revision: 1.9.2.2 $ $Date: 2002/01/14 13:57:53EST $
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Corner Coordinates:
Upper Left  (  593925.000, 5207115.000) (103d45'51.49"W, 47d 0'39.20"N)
Lower Left  (  593925.000, 4994355.000) (103d48'22.63"W, 45d 5'47.13"N)
Upper Right (  817425.000, 5207115.000) (100d49'44.62"W, 46d56'29.49"N)
Lower Right (  817425.000, 4994355.000) (100d58'13.21"W, 45d 1'53.45"N)
Center      (  705675.000, 5100735.000) (102d20'32.55"W, 46d 1'45.41"N)
Band 1 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
Band 2 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
Band 3 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
Band 4 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
Band 5 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
Band 6 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
Band 7 Block=7450x1 Type=Byte, ColorInterp=Gray
  Overviews: 3725x3546, 1863x1773, 932x887, 466x444, 233x222, 117x111, 59x56, 30x28
-------------------------------------
Then I run,

gdal_translate -b 1,2,3 -srcwin 100 100 200 200 /mnt/dngp_images/3328_092002.tif
tmp.tif

and

gdalinfo tmp.tif, I got the following

----------------------------------
Driver: GTiff/GeoTIFF
Size is 200, 200
Coordinate System is:
PROJCS["WGS 84 / UTM zone 13N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235629972,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree (supplier to define representation)",0.01745329251994328],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-105],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32613"]]
Origin = (596925.000000,5204115.000000)
Pixel Size = (30.00000000,-30.00000000)
Metadata:
  TIFFTAG_SOFTWARE=IMAGINE TIFF Support
Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved
@(#)$RCSfile: etif.c $ $Revision: 1.9.2.2 $ $Date: 2002/01/14 13:57:53EST $
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Corner Coordinates:
Upper Left  (  596925.000, 5204115.000) (103d43'31.75"W, 46d59'0.48"N)
Lower Left  (  596925.000, 5198115.000) (103d43'36.36"W, 46d55'46.15"N)
Upper Right (  602925.000, 5204115.000) (103d38'47.80"W, 46d58'57.22"N)
Lower Right (  602925.000, 5198115.000) (103d38'52.70"W, 46d55'42.90"N)
Center      (  599925.000, 5201115.000) (103d41'12.15"W, 46d57'21.71"N)
Band 1 Block=200x40 Type=Byte, ColorInterp=Gray
---------------------------------------------------------

Note, there is only band left.

What could be wrong?

Thanks
Xiaodong







More information about the Gdal-dev mailing list