Monday, June 22, 2020

Trick to select multiple datasets for batch processing in ArcMap

I recently rediscovered a handy little trick for multiple selecting multiple datasets. Most tools in ArcMap have one input and one output.  This trick doesn't apply to those tools.  However, there are tools such as Cell Statistics or Mosaic to New Raster or Mosaic that can take multiple inputs.  If you are finding yourself repeatedly hitting the "add data" button or dragging and dropping there is a solution that will save you time!

1.  Open Windows Explorer/My Computer if you are using a Window machine and navigate to the folder that you wish to search.  In this case I've got monthly rasters with each having the names _01.img, _02.img, etc. to denote January, February, etc.



2.  In the search window type in *_01.img or something similar to filter out all of the January files.  This will result in a whole slew of files, some that are the regular IMG file and others that XML files.

3.  Hold down the shift key and select all of the files including the XML files and drag them into the ArcMap Table of Contents.  One option that I recommend is to disable "make newly added layers visible" in ArcMap.  To disable this go to Customize --> ArcMap Options --> General --> and uncheck "make newly added layers visible".  This will make it quicker to load the layers in the Table of Contents in ArcMap without having to draw every layer.





4.  The layers will now all be shown in the Table of Contents in ArcMap.  The nice thing is that ArcMap knows not to try to add the XML file into the Table of Contents so you are left with just the image files.





5.  Open the cell statistics tool from ArcToolbox and select the statistic that you wish to have calculated (e.g. SUM, MEAN, etc.).  Shift select all of the layers that you want added and drag them in as input layers into the Cell Statistics tool.

The nice thing about this trick is that it is simple and requires no programming or Model Builder.