Dark theme

ArcGIS ModelBuilder


This practical involves using ArcGIS ModelBuilder to build a model, convert this into a Python script, then modify this script to get it to run just like the model from ArcToolbox.

ModelBuilder is a visual programming tool that provides ArcGIS users with a way to develop automated data processing workflows. Each workflow or model comprises a visual set of nodes that are connected together in a directional way. It is clear which nodes are inputs, which are outputs and which are functions. ModelBuilder can be used to make models that have multiple inputs and outputs, and that access both standard ArcGIS functionality and additional functionality custom added to ArcToolbox.

ArcToolbox is an integrated application that is part of ArcGIS. It provides an organised collection of Toolboxes that may contain Toolsets and individual Tools. What can be accessed via the integrated application can be customised. Toolboxes and toolsets can be thought of as folders or directories, and individual tools are the functional methods that can be organised in models. The toolboxes, toolsets and tools are organised/listed alphabetically.

ModelBuilder models can be converted into Python scripts in ArcToolbox. These Python scripts utilise ArcPy - a Python module developed by ESRI to support the editing and execution of Python code that utilises ArcGIS functionality. ArcGIS version 10.6 generates Python 2.7 code which is expected to be run in a special Python environment installed with ArcGIS. This special Python enviornment is loaded with a few modules beyond the standard Python 2.7 environment that ArcGIS requires, but it might not contain everything you are used to being there. Also, if you are used to Python 3, then beware that some syntax is a little different in Python 2. Furthermore beware that if you are not using ArcGIS 10.6, you may also run into issues as there can be some fairly major differences between minor versions of ArcGIS!

In this practical we develop a simple ModelBuilder model that combines a couple of spatial analysis functions/methods/routines/workflows/models. We learn how to parameterise/generalise the model, convert it into a Python script, and get this to run like the model from ArcToolbox.

Please read each section to the next dotted line before trying to follow the instructions step by step.


To begin with, Open ArcMap with a blank map and check what version of the software you have. (It may take a minute or so for the software to load). Download this zip file and unzip it somewhere on your M drive. For the sake of this practical, we'll assume it is unzipped to m:\GEOG5790M\data\input. The zip file contains some shapefiles and some layer files representing a small part of a built up area. Shapefiles are currently a common GIS data format. Each shapefile is a collection of files that have the same name prefix, but different file extensions. The main shapefile file has a .shp extension. (Sometimes when you are provided with a shapefile, the .shp is the only file, but typically there are more). Layer files are a single file with a .lyr extension. The layer files in the zip were created from the shapefiles using Arc and they have the same name prefix as the shapefile they were generated from. Layer files do not have to be named thus, but they are in this case. In a later practical, we will learn how to convert shapefiles into layer files programatically using ArcPy.

Essentially, what we're going to do is imagine a bomb exploding at a point location in the built up area represented by the data. The idea is to buffer the point location and intersect the resulting 2D circular region with a buildings layer to identify the parts of buildings that are most likely to have been effected in the explosion.

(Originally this set of practicals used a different input data format - ArcInfo interchange or E00 files. The E00 files were converted into ArcGIS Coverages and the buffering and intersecting was done using these coverages. However, whilst the conversion to coverages can still be done with ArcPy using ArcGIS 10.6, it seems that there is no longer a way to refer to these coverages in ArcPy! This is definitely worth knowing, irrespective of whether this is a bug or an intentional change...)


Next we'll add a Toolbox. If you can't see ArcToolbox, click on the Toolbox icon, as shown in the red circle, below.

Screenshot: ArcToolbox

Right-click on the ArcToolbox root icon (as above), and select Add Toolbox.... This will bring up a FileDialog. Navigate to m:\GEOG5790M\practical1\ (creating the directory if necessary) and then click the little Toolbox icon in the top right corner of the FileDialog (see below). This makes a new Toolbox.

NB: you may find that you need to connect to the folder to see it. To do this, use the icon that's a folder with a little "+" symbol on it. After you've connected to a folder, it should appear under "Folder connections" in file dialogs.

Screenshot: New Toolbox icon

Change the name of the Toolbox from Toolbox.tbx to Models.tbx and then select it. Press Open. This should add the new toolbox to the ArcGIS Toolbox. It should appear alphabetically listed.

NB: You may find that renaming one toolbox appears to rename them all. This is probably just a display bug! If you cancel the dialog and re-open it, the new Toolbox should be there, renamed, along with the others all correctly named.


  1. This page
  2. Making a model <-- next
  3. Enhancing the model
  4. Running the model
  5. Building a script