Tuesday, March 8, 2016

Landsat QGIS tutorial -- Import and Band Ratio

This was written as a rough work flow for a colleague working on a project:

1) Create a personal account at http://earthexplorer.usgs.gov/ , mark your interest area and dates. Do not search to large date periods, only the first 100 results will be shown. Then choose Landsat-8 under Datasets>Landsat Archive:



2) Under Additional Criteria you can choose cloud cover threshold, but it seems to me that it is best to search for all scenes. A scene may have 80% cloud cover, but possibly just your glacier may be cloudfree on that image. There is very few cloud free images for Svalbard!

3)  In the result list, choose the scenes you want to download. Either add them to the bulk download, or use "download option" to choose a single scene. Get the GeoTiff file: 


4) The Landsat files are a Tif-file for each channel, but for displaying band combinations you need to merge these into one file:

5) Extract the Landsat zip-file and then find the merge dialog in QGIS: 


6) Choose all bands of the Landsat image to be merged. Be sure to have "layer stack" chosen!

7) For displaying a rgb image, you have to check which band is red, green or blue. This varies between Landsat sensors, consult this page for finding out. For Landsat 8, rgb is channel 4,3,2

Choose the property dialog (right-click the Landsat layer and choose "property" to view various band combination, in this example for Landsat-8 it is rgb, i.e. the regulart visual view by assigning 4,3,2 to r,g,b:


8) Band Ratio images: For discerning surfaced, often ratio between various bands are used. A known one is the NDVI index 
For glaciers, GLIMS suggests a few band ratio approaches, like "(TM3 / TM5)>2.6" Be aware that band numbers do not correspond to the same wavelength bands on different sensors, not even between different Landsat sensors! Check which actually wavelengths bands your formula operates with.

To create a band ratio image, use the QGIS raster calculator. This example calculates an output raster with (band4 / band5 )>2.6, but you could do any other operation you like

Reshaping Polygons in QGIS

We have shapefile giving the glacier outlines on Svalbard, now after a few years we want to update these outlines since glaciers have changed in extent:


For reshaping this polygon, activate the advanced digitizing menue in QGIS:


Then select the shapefile layer, choose "toggle editing" to make the shapefile layer editable and choose the "Reshape Feature" Button:

 Now start digitizing, first click outside the polygon, crossing the old glacier front, the digitize the new glacier front, and at the end again cross the old front line as indicated here. Below you see this for e retreating glacier, similarly an advancing glacier you cross the old front line before digitizing the new front. THe principle is nicely explained at this blog post. You can zoom into the image use the arrow keys to move the image while digitzing:

Start Digitizing:

End of Digitizing: 

For an advancing glacier you start and end by crossing the polygon like this, again look at this blog post to understand the principle: 



When you now right click, the polygon is adjusted to the new front line:

Now select the polygon you just edited, right click the layer and choose "open attribute table. In the table you choose to show the selected polygon, where you can update the relevant columns (year, date, analyst, source2 and sensor):