Mosaic tifs in a folder, then iterate process in next folder

306
1
09-21-2020 10:53 AM
MarkSanford
New Contributor

I have 30+ folders, each folder contains 8-20 tiffs. How can I mosaic the tiff's in the 1st folder together (using the folders name as the mosaic outputs name), then change to the next folder and repeat the mosaic operation, each time creating a new raster mosaic of just the tiff's in a given folder.

Sure, I could run mosaic_to_raster over and over changing the input workspace (folder) and entering an output name, but there must me a way to automate the iteration from one folder to the next and run the mosaic process per folder?

Example:

cd to folder 1 (00114), mosaic 9 tiffs and output to 00114.tif, cd to next folder "00115" and mosaic 10 tiffs and output to 00115.tif, cd "00116".......

All the individual folders are under one main folder or workspace named "Blocks".

0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor

This type of problem is usually easier scripting in python but if you are looking for a model builder solution you need to read the help file on embedding models within models. Your master model iterating over folders with the sub-model iterating over rasters in a folder collecting the values which you then feed into a mosaic tool.

0 Kudos