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,461 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



by Technical Evangelist
on ‎08-14-2017 05:23 AM

Hi Emana,


No screenshots came through so I'm unsure what model you are trying to run or what the problems are. Can you please describe the state of the data you are trying to process, what model you are trying to run and what messages you might be seeing in the Messages pane.




on ‎08-14-2017 06:34 AM

Dear Ian


Thank you for your mail.


I am not dealing with stacking landsat tar.gz files anymore


I was trying to use teh spatual model created for me by Mvardovs.


I have successfully done that and I have now run the model.





on ‎01-14-2020 12:38 AM

Hi Folks,


I have quick, naive question. I'm trying to make an iterator that will run operators folder by folder. I know it has something to do with the 'MultiFileNameInput', an iterator, subfolders, and the right wildcard but I just can't get it to work. It's just the first part of the model that needs help. It goes on to generate a report and some other things that work fine. I've checked out a few other models that use this but I'm having trouble getting it structured properly. 

Suppose the file structure is:

Directory: LSAT8 --> Subdirectory with folders entitled: LSAT8_1, LSAT8_2, LSAT8_3.....Captur.JPG


Thanks for any advice!