Showing results for 
Search instead for 
Do you mean 

Landsat Stacking from .tar.gz archives

by Technical Evangelist on ‎08-02-2017 12:36 PM - edited on ‎02-24-2020 03:27 AM by Community Manager (7,488 Views)

Download model







Based on the articles "Commandline Iterator - Extract Landsat TarGz Files in Batch" and "Stack Landsat8 MSI" our partner in the UK, Sterling Geo, has come up with a very interesting and useful Spatial Model capable of unpacking the .tar.gz archive files commonly used when downloading Landsat archived data, whether or not it is for Landsat 5, 7 or 8, and creating layer-stacked images. Here are the details:


This model is capable of unzipping and stacking all Landsat 5, 7 or 8 format files in a folder (new or old USGS format).


The only inputs required are the input and output directory and whether or not to output the cloud (BQA bands and cirrus) or Panchromatic data. It will then loop through all tar.gz files in the input directory and create stacked and automatically named image files in the output directory.




Firstly the model identifies which Landsat format the file is in, running only if that type exists.




Then the unzipping operation runs to extract the individual tiff files from the tar.gz.This community post was used to add the unzipping functionality. "Commandline Iterator - Extract Landsat TarGz Files in Batch"


Note that if you did not install ERDAS IMAGINE into the default path, you may need to dig into the Model and change the location of the un zipping program, as described in the linked article.


Next the extracted folder is used in a stacking sub model, stacking the bands into a msitir image (and the optional Pan and BQA images). The output multispectral images are named using the metadata file into; Landsat(5/7/8)_WRSpathWRSrow_Date Acquired(_pan/_cloud).img.



Landsat type

Bands used

Optional outputs

Landsat 5

Bands stacked: 1 to 7

BQA (Collection 1 only)

Landsat 7

Bands stacked: 1-7 including thermal

BQA (Collection 1 only) and panchromatic option

Landsat 8

Bands stacked: 1-7, 10, 11 

BQA and panchromatic option



on ‎08-06-2017 05:58 AM - last edited on ‎08-07-2017 05:39 AM by Technical Evangelist


Dear Ian Anderson,


Many thanks for this announcement.



I spent the whole of yesterday trying hard to use the import data function from ERDAS imagin 2015 to directly import landsat 7 etm.  I did everything including  the following steps but still got an error message that said “THE GIVEN INPUT FILE IS NOT IN THE USGS FORMAT”

  1. Selecting the input file directly from my download archive which comes with the original file extension gz.tar (it didn’t work)
  2. I unzipped the files from tar.gz to .tar (it still didn’t work ). ERDAS imagine still couldn’t import the file directly through Import manager

Then today, I ran into this announcement by.. with a part of the announcement that says (This model is capable of unzipping and stacking all Landsat 5, 7 or 8 format files in a folder (new or old USGS format).

Could it be that this error is coming up because I am working with the newly reprocessed  Collection 1 Level 1 data from Landsat?


In this case, do I need to update my ERDAS software? Any tip on that?



Secondly, I couldn’t also find the Landsat sensor displayed on the multispectral , when I tried doing my band combination. What could be the problem? And what can I do in this case? Should I simply highlight CUSTOMS? I am working on vegetation mapping and change detection.



Please some one help please .  I am not sure


I will greatly appreciate a response from you and other members please

by Technical Evangelist
on ‎08-07-2017 05:51 AM

Hi Kansy,


You may get more responses by posting your questions in the Support community section. But let me see if I can help....


  1. Did the Spatial Model successfully import the data, or did that fail as well? It's possible you have a formatting that isn't supported yet by the importer (what version of ERDAS IMAGINE are you running - v16.1?). It would be best if you logged a support ticket so that someone can take a look at the data you have and confirm if it's the variant that will be supported in ERDAS IMAGINE 2018.

    You might also want to try this:

    "If you change the name of the new *.tar.gz files to match the same naming format of the older files the importer will work. For example, change the filename from “LC08_L1TP_037025_20170325_20170329_01_T1.tar.gz” to “LC82017032520170LGN00.tar.gz” and it will work."

  2. How many bands does the stacked image you created have? A Landsat 7 ETM+ would normally have 6. If it doesn't have 6 then it probably isn't being recognised as Landsat 7.




on ‎08-14-2017 03:09 AM

Dear Ian,


Thank you for your message


Since I couldnt get through this step of directly importing the datasets using the Import Manager, I had to do a manual unzipping of of teh tar.gz files.


I have gone pass that step now but encountering another bottle neck!


I am trying to gap strip Landsat 7 images which had teh SLC  off gaps. Landsat recommends that these SLC off images are subjected to some analysis to make them useable for scientific use.  I have done the first stage of these procedures  (focal analysis ) and about to do the next step.


But i need to unpack (or maybe say un-composite ) the bands in which I had merged in the first step of the process . it is only on unpacking the 3 bands that I will be able to carry out the second procedure to make the images more useable for NDVI computation.


It is at this stage that Emily , created a model for me and advised that I use teh spatial editor in achieving this disentangling step.


When I couldnt achieve this step using the spatial editor model, Jeff opined that ERDAS IMAGINE 2015 may not support the spatial editor model and I need to upgrade to 2016.


That i have done and I have upgraded to 2016 but at this momemt unable to run the licence from our university server.


Hence I am stuck!!!!!!!!


And need further remote advice and support

on ‎08-14-2017 03:16 AM

Dear ian,


Apologies . I need to correct this information.


It was Mvardovs that created the model for me and NOT Emily


Emily helped me with the basic layer stacking problems which I had initially.


Many thanks



on ‎08-14-2017 03:46 AM

Dear Ian,


I have successfully installed ERDAS 2016 and it is working through a server licence.


I have also successfully opened the Spatial model Editor and have followed the steps you outlined.  I have inputed the band of interest using the Raster Input icon of the spatial model editor.


Here is a screen shot of what i did.


How then do I see the unpacked bands


Where should I click , how should I proceed?