The ModelBuilder tool has been available in ArcGIS for Desktop since 2004 and it quickly gained a reputation of an easy-to-use application. It which can help the user to execute an entire geoprocessing workflow by adding and connecting tools and input/output datasets together in a graphical environment. Models created in the ModelBuilder are executable workflows that string together sequences of geoprocessing tools, feeding the output of one tool into another tool as input.
Such a workflow can be executed as a tool (if you right-click on it in the catalog window in ArcMap), or it can be exported to a python script and be incorporated into a larger script later on. And of course, you can trigger the execution of the model from within the ModelBuilder Window.
A model can have parameters – the elements that a user marks as “parameters” – so that they appear in the tools dialog if a model is executed as a geoprocessing tool using the tool’s dialog. You can find some information to get started with the ModelBuilder here: >>
Today I will show you one of the ways to turn your geoprocessing models into interactive geoprocessing tools by using the Feature Sets.
Imagine that you need to run a model using just a small piece of the entire dataset and avoid using the CLIP tool, because it will duplicate the data. In another scenario, you may need to select an area on the map and apply your geoprocessing model to the features that are completely contained by this selected area only. Another possible situation: you need to use a model containing a tool that requires a point input, like the Viewshed Tool, which requires the observer’s location to be specified. Well, let’s make these models a bit more interactive by using Feature Sets in the ModelBuilder.
I will create a simple model that uses the Viewshed tool mentioned above. This tool is included in the 3D Analyst and Spatial Analyst toolboxes and it is used to determine the raster surface locations visible to a set of observer features. All you need to run this tool is a DEM (DIGITAL ELEVATION MODEL), observer features – points with known X,Y,Z locations and a license for either 3D analyst or Spatial Analyst.
Step 1. Open the Model Builder
Drag and drop the DEM and the Viewshed (Spatial Analyst) tool to the Model.
Connect the DEM to the tool as “input raster”
Step 2. Create a layer file.
Add a random point feature class to ArcMap, set the symbology to whatever you like (I used simple marker symbol, size = 18) and right-click on the layer in the table of contents to save it as Layer (*.LYR) file.
Don’t worry about coordinate systems or anything else – all only need to use it as a dummy layer to create a layer file.
I called my layer file symbology.LYR
Remove the point layer from ArcMap, you won’t use in this workflow.
Step 3. Add a new “Feature Set” variable
In the ModelBuilder navigate to Insert > Create Variable
Set the type to Feature Set:
Connect the new variable to the Viewshed Tool as “Input point or polyline observer features”
Assign the symbology to the new variable. Right-click on the Feature Set and navigate to Properties > Data Types.
Click Browse next to Import Schema and symbology and navigate to the layer file that you saved in the previous step.
Note: just keep in mind that if your DEM raster uses a Geographic Coordinate system you will need to apply the Z-factor to re-calculate the units of the coordinate system to metres.
The model is now ready to run even despite one of the parameters hasn’t been specified. It’s an optional output dataset produced by the Viewshed Tool and we won’t use it in this example.
Step 4. Set the model parameters.
We will run this model as a geoprocessing tool, using a standard tool’s dialog with parameters. And to make an element from your model appearing in the tool’s dialog, you need to mark it as “model parameter”.
Right-click on the input variables (the blue ovals) and choose “model parameter”.
In the end the model will look like the following one:
Save the model in a custom toolbox.
Close the ModelBuilder.
Step 5. Locate the model in the Catalog Window and double-left click on it to open the tool’s dialog.
The tool’s dialog will contain a feature template, just like the one you can use in Editing:
Click on the template and then click on the map to select the observer’s location (or a few locations). Run OK to run the Tool and execute the model.
Analyse the result in ArcMap:
You can also overlay the resulting visibility raster over a DEM in ArcScene:
This was just one of the many examples of how an interactive input can be implemented to make your ModelBuilder model dynamic, interactive and fully customizable. You can use feature sets to select elements, digitise the areas of interest, pinpointing locations and then process this information in the model.
Additional information about feature sets and record sets is available in the online help: >>
If you are keen to learn more about building geoprocessing models in the ModelBuilder and would like to discover the full potential of this visual geoprocessing environment, come to our training course Geoprocessing Workflows. See you there!