Building a Model with ArcGIS ModelBuilder Saves Time

Emmanuel Jolaiya


In the previous article in this series, Emmanuel Jolaiya provided an introduction to ArcGIS ModelBuilder. In this article, he will be showing users how to use ArcGIS ModelBuilder to develop a model for for analyzing and manipulating GIS Data.

Not to scare you, but this is going to be a really long tutorial. I hope to start a YouTube channel soon, particularly for long tutorial articles like this. But, in the meantime, enjoy this 🙂

Practical Demo

In this practical demonstration, I’ll be building a model for masking a study area from imagery and calculating the NDVI for the study area. You might be wondering why I want to do this, well, the simplest answer is because I know I’ll most likely carry out similar analysis in the nearest future, so to optimize time in future projects and avoid opening the raster calculator every time, I’ll be designing this model. Yours can be a different reason but the common thing here is that we are trying as much as possible to optimize our time and energy and avoid carrying out repetitive tasks.

Specifications of software and data used:

In this demonstration I’ll be using the following;

Free weekly newsletter

Fill out your e-mail address to receive our newsletter!

Software: ArcMap 10.7 (don’t worry, all ArcMap versions have ModelBuilder, so you can still follow along : ) )

Data: Landsat 8 OLI/TIRS and a feature class (study_area.shp).

Goal: Mask the study area from the Landsat imagery and calculate NDVI for the study area.

Step 1

I’m assuming you have the software installed as well as the data downloaded. Otherwise, you can check here on how to install ArcMap 10.x and here to download Landsat imagery from the USGS data archive.

If you have all the requirements in place:

1. Launch your ArcMap

2. Create a new map document or open an existing map document.

3. On the menu bar, hover on Geoprocessing, select ModelBuilder from the drop-down menu to open the model builder window. (see below)

Opening the ModelBuilder window
Opening the ModelBuilder window

The model builder window will appear.

The model builder window
The model builder window

4. Add the data, (this can be done before step 3 as well)

Adding data to ArcGIS ModelBuilder.
Adding data to ArcGIS ModelBuilder.

You might be wondering where the model builder is, see it at the bottom left of the data frame.

5. When designing a model, there are two major ways we navigate through the model (personal view): 

a) Sketching/drafting method:

This is a process whereby the workflow for the whole analysis is sketched/drafted before beginning the process. This is very good when designing a very complex model.

b) On-the-fly designing.

This is the direct opposite, it involves making decisions as the model evolves. It’s very good when designing simple models.

We’ll be adopting the second option in this demonstration.

Having known that, we can expand our model builder window or re-open using the method I described above in case it’s closed.

Step 2

1. Add in the needed tools. Since we already defined our goal above (masking and NDVI calculation), this has informed us of the needed tools which are the masking tool and the raster calculator.

Search for tools, ArcGIS.
Search for tools, ArcGIS.

To access the masking tool, I’ll be using the search for tools window from the Geoprocessing tools in the menu bar (see above)When clicked, a search window will appear by the right (see below).

Use the search window when using "search for tools" in ArcGIS.
Use the search window when using “search for tools” in ArcGIS.

When it’s opened: search for Masking tools and Raster Calculator

Scroll down to select the Extract by Mask (Spatial Analyst) tool and drag it into the model builder window. You should have something like in the image below.

Extract by Mask (Spatial Analyst) tool
Extract by Mask (Spatial Analyst) tool

Repeat the same for the raster calculator by searching for a raster calculator (spatial analyst) and dragging into the Model Builder window. You should have something like the image below.

The model builder has a lot of features that we can take a quick tour here to learn about. For the sake of this demonstration, I’ll be going straight to the matter of the day.

We said our goal is to clip a portion from the imagery and calculate NDVI for that portion, and NDVI calculation requires Band4 and Band5 of Landsat 8 imagery, this can vary depending on your imagery source. That means we would need to add one more masking tool, so we can use it to mask the Band4 and Band5. Let’s drag one more masking tool, following the steps above.

There are overlaps in the tools, right? To change this, click on the icon (check arrow direction) to auto-layout the tools. Take a quick tour of ModelBuilder if you haven’t.

You should have something like this after clicking the icon.

Double click on the tools to fill in the data. Below is the Extract by Mask tool interface.

You should have something like this after you fill in all information (input raster, shapefile to mask, and output raster location).

Color code: Yellow represents the tool, blue represents the input, green represents the output. Now let’s open the raster calculator to calculate the NDVI. I’ll be using the B5mask.tif and the B4 mask.tif for the calculation. This is because that is the name I gave the output of the masking tool.

When you auto-layout using the icon I described above. You should see something like this.

for any errors. Click on the validate all model icon to do this. Before we run the model, If you want the output/final result (NDVI) to appear in your table of content, right-click on NDVI.tif and click ‘Add to Display’.

Now you can run your model. Using the icon beside the validate model icon or go to the menu bar, left-click on the model, and click Run.

While executing the red color shows the current tool it’s executing. This took me only a few seconds to execute, instead of more, If I do had gone the manual way. Now, I have my NDVI ready in the table of content and the display. Cool right? 

This is obviously the tip of the iceberg, I’ll show you how to turn the model we built above into a reusable tool in a future tutorial.   

Woo-Hoo! You made it! Thank you for reading along, If you found this tutorial article useful kindly share with your network. Thank you!


About the Author

Emmanuel Jolaiya is a GIS analyst, data scientist, and GIS development enthusiast with a keen interest in transforming data into insights that aids in making informed decisions. He is a 2020 YouthMappers Research Fellow and  2020 Esri Nigeria, Young Scholar Awardee. He has a passion for data and technology with a focus on building sustainable architecture for interoperability and efficient data use toward building solutions that address the most pressing issues in our world and ultimately making the world a better place for us all. Follow him @jeafreezy

Photo of author
About the author
Emmanuel Jolaiya