How to create a color raster from LandSat 7 imagery, using The Gimp and other open source tools.
This small tutorial explains how to download, prepare, cut and finaly create a background raster from LandSat 7 imagery.
You will need:
First you have to choose and download the correct image for your zone, there is a very nice web tool that allow you to interactively choose and download the images: UMIACS, through this web interface you can choose which satellite imagery to download, best resolution you can get is color images at 30m resolution and black and white at 15m resolution from ETM+.
After selecting the images, press "Preview and download" and you will be redirected to a FTP download page, where the number of available files could be somewhat confusing… (didn’t I select just one tile? Why all those files?)
The larger files end with some digits, they correspond to the various sensors the satellite carries. Take alook to the technical guide at http://glcf.umiacs.umd.edu/data/guide/technical/landsat.shtml to determine which bands (files) you actually need.
Landsat 7 ETM+ Resolution (m) Band 1: 0.450 - 0.515 Blue 30 Band 2: 0.525 - 0.605 Green 30 Band 3: 0.630 - 0.690 Red 30 Band 4: 0.760 - 0.900 Near IR 30 Band 5: 1.550 - 1.750 Mid IR 30 Band 6: 10.40 - 12.5 Thermal 60 Band 7: 2.080 - 2.35 Mid IR 30 Panchromatic Band 8: 0.52 - 0.92 Pan 15
We will need bands 1, 2, 3 and maybe 8, the first are for visible Blue, Green and Red, the last for panchromatic (black and white) hi-res.
You can use
gdalinfo p193r029_7t20010801_z32_nn30.tif to see the metadata (projection etc.) associated with the GeoTIF file.
After downloading and inflating those huge files, you will get a set of GeoTIFF files, they are normal TIFF B&W image files with datum and othe GIS informations embedded. If you don’t have a Cray (like me) you will need to cut those images in smaller tiles and process them independently.
The GDAL tools allow you (among other functions) to extract a tile from a raster file, the command in my case was:
gdal_translate -projwin 577630.875 4894540.125 623230.875 4850365.125 -of GTiff p193r029_7t20010801_z32_nn30.tif red.tif This command extracts a window from the file (you have to specify the bounding box and the output format, in this case always GEOTIFF), this step must be repeated for the three visible bands, the output files can be named red, green and blue, to ease recognition when you will combine them in a single color image.
You now have three B&W TIFF images, they must be combined in one RGB image.
- Start The Gimp,
- and open one of the files,
- then save it with a new name (say rgb.tif)
- and erase the image, just select all and hit Ctrl+X.
- change the image mode to RGB (menu image, then mode, then RGB)
Now you must use a filter to decompose the image in the three RGB bands, just choose "Decompose" form "Filter" and "Colors" menu.
A new window with three layer, named Red, Green and Blue opens (the name of this winndow should end with RGB). Now open the three original B&W images (red.tif, green.tif and blue.tif).
You now need to compose the three bands into the new RGB image, click in the RGB window (the one that opened after the decompose command) to get the focus, now choose "Compose" form "Filter" and "Colors" menu. In the dialog box, select the three monochromatic bands from the select controls, of course you must respect the correct colors, assign red.tif to red and so on.
You should now have your RGB raster almost ready for use!
Doing the same (and more) with GRASS
I’ve found a very useful tutorial for doing the same with GRASS, the result is probably even better! If you’re interested, please follow this link.