A quick tour of executing tools

There are a number of ways you can execute tools. The most common method is to open the tool dialog box, fill in its parameters, and click OK to execute the tool. For system tools, tool execution occurs in the background, meaning that you can continue working in ArcMap while the tool executes. You will receive a notification message when the tool finishes, and you can view information about the tool's execution in the Results window. Normally, outputs created by tools are automatically added to the ArcMap table of contents.

To execute a tool, you must first locate the tool by searching for it in the Search window or browsing to it in the Catalog window.

Learn more about finding tools

Executing tools using the tool dialog box

To open a tool dialog box in the Search window, click the tool name.

Opening the tool dialog from the Search window

To open a tool dialog box in the Catalog or ArcToolbox window, double-click the tool or right-click and choose Open.

Opening the tool dialog from the Catalog window

After the tool dialog box opens, you fill in the tool's parameters. Each tool has its own unique set of parameters. Some parameters are required—they must be filled in (that is, they must have values) for the tool to execute. Other parameters are optional, meaning you can leave them blank or accept their default values. Tools have both input and output parameters. Input parameters are typically existing datasets or options that control what the tool does. Output parameters are usually new datasets created by the tool. For output dataset parameters, an output dataset name and location are automatically created for you after you have entered one or more input parameters.

Learn more about using a tool dialog box

Executing tools using ModelBuilder

ModelBuilder is a powerful application that allows you to string together a sequence of tools, using the output of one tool as the input to another tool, as illustrated below.

A simple model

In ModelBuilder, you add a tool, open its dialog box, fill in parameters, then click the OK button. The tool does not execute when you click OK—you have to run the model for the tool to execute. This allows you to string together multiple tools and execute them all at once.

Models are how you automate your work. When you create a model, you are preserving a data processing workflow that you can execute multiple times using different input data. There are an infinite number of tasks you can automate using models.

Executing tools in ModelBuilder tutorial

Executing tools using the Python window

Tools can also be executed in a text-based programming language such as Python. Since Python is text based (rather than a visual programming language like ModelBuilder), you type the tool name followed by its parameters. The Python window, illustrated below, is where you can enter Python code and execute it immediately.

The ArcPy window

Although this may seem like extra work compared to using the tool dialog box (who wants to type a bunch of stuff?), there are advantages to using Python and the Python window:

More advanced Python code in the Python window

Learn more about the Python window

LegacyLegacy:

Python code that executes a geoprocessing tool is sometimes referred to as a command. Prior to ArcGIS 10, there was the Command Line window where you could execute geoprocessing tools by entering text (you couldn't use Python). The text you entered was called a command. In ArcGIS 10, the Python window replaced the Command Line window, but the term command has stayed around—you may occasionally find it in documentation. A command is equivalent to executing a geoprocessing tool function in Python.

Executing tools within Python scripts

The Python window is where you enter code and execute it immediately. But you can also use a text editor or an integrated development environment (IDE) such as PythonWin to create Python files on disk (files with a .py extension). These files, known as scripts, are programs you can execute from either the operating system prompt or by creating a script tool that executes the script. A script tool is just like any other geoprocessing tool--you can execute it using its dialog box, within models, in the Python window, or in Python scripts.

Learn more about writing Python scripts

Environments affect tool execution

Environment settings can be thought of as additional parameters that affect the execution of a tool. Environments differ from normal tool parameters in that they do not appear on a tool's dialog box or Python usage (with certain exceptions) but are set using a separate dialog box or function. Environment settings can significantly affect tool execution. For example, you can set the Extent environment so that only the features in the current map extent are used in tool execution. You can set the Output Coordinate System environment so that your tool writes its output features in a different coordinate system from the input features.

Learn more about geoprocessing environments

Related Topics


12/15/2011