[Gdal-dev] Combine multiple Tiffs into a single Tiff
Paul Surgeon
surgpub at telkomsa.net
Wed Oct 5 17:06:15 EDT 2005
On Wednesday 05 October 2005 22:15, Rob McCulley wrote:
> Hi,
>
> I've got a Landsat image downloaded off of Geobase. By mistake, I
> downloaded a version with each band of landsat info in a separate GeoTiff
> (I would rather have had the bsq file, I know how to deal with it). Can I
> use GDAL to merge three of the bands into a single RGB GeoTiff? If not,
> what is the best way to do this?
>
> Thanks,
> Rob McCulley
> GIS Coordinator
> County of Vermilion River No. 24
> (780) 846-2244
> rmcculley at county24.com
> www.vermilion-river.ab.ca
Hi Rob
You can use VRTs to compose the bands into a single image and then use
gdal_translate to write to a single GeoTIFF.
Example :
Here is rgb.vrt which is a plain text file.
<VRTDataset rasterXSize="8675" rasterYSize="7762">
<SRS>PROJCS["WGS 84 / UTM zone 33N",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.2572235629972,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",15],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32633"]]</SRS>
<GeoTransform> 5.7926250000000000e+05, 2.8500000000000000e+01,
0.0000000000000000e+00, 5.5269195000000000e+06, 0.0000000000000000e+00,
-2.8500000000000000e+01</GeoTransform>
<Metadata>
<MDI key="TIFFTAG_RESOLUTIONUNIT">2 (pixels/inch)</MDI>
<MDI key="TIFFTAG_XRESOLUTION">72</MDI>
<MDI key="TIFFTAG_YRESOLUTION">72</MDI>
<MDI key="AREA_OR_POINT">Point</MDI>
</Metadata>
<VRTRasterBand dataType="Byte" band="1">
<SimpleSource>
<SourceFilename
relativeToVRT="1">p189r026_7t20000802_z33_nn30.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="8675" ySize="7762"/>
<DstRect xOff="0" yOff="0" xSize="8675" ySize="7762"/>
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="2">
<SimpleSource>
<SourceFilename
relativeToVRT="1">p189r026_7t20000802_z33_nn20.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="8675" ySize="7762"/>
<DstRect xOff="0" yOff="0" xSize="8675" ySize="7762"/>
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="3">
<SimpleSource>
<SourceFilename
relativeToVRT="1">p189r026_7t20000802_z33_nn10.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="8675" ySize="7762"/>
<DstRect xOff="0" yOff="0" xSize="8675" ySize="7762"/>
</SimpleSource>
</VRTRasterBand>
</VRTDataset>
Then to write the VRT as a GeoTIFF :
gdal_translate rgb.vrt out.tif
Simple as that!
If you use OpenEV with the compose tool you don't have to type in all the all
the projection and datum info and you can export directly as GeoTIFF (it just
uses gdal in the background)
Regards
Paul
More information about the Gdal-dev
mailing list