The most common input to a tool is a dataset. You can, of course, always browse to the dataset on disk, but you can also use layers or table views as input.
- A layer is what you see in the ArcMap table of contents. A layer contains the path to the dataset along with symbology information and feature or row selection information.
- Table views are the table equivalent of a layer. They are tables stored in memory and are the same as the table view created when a table is added to ArcMap. You can view tables by clicking the List By Source button found at the top of the table of contents, as illustrated below.
When you open a tool dialog box in ArcMap or enter a tool name in the Python window, the following occur:
- ArcGIS examines the tool's parameters to see which parameters use an input dataset or table. If one is found, it further examines the type of input dataset. Is it a point feature class? A TIN? A network? A table?
- The ArcMap table of contents is then scanned and filtered to see whether any layers match the parameter's dataset type. If so, a list of the matching layers is built and presented as a drop-down list in the parameter's control. You can choose one of these layers or table views as your input.
The following illustration shows the Buffer tool and the drop-down menu of layers it constructed for the Input Features parameter.
Using layer files
Layers can be saved to disk as a layer file (a file with the .lyr extension), then used as input to any tool that accepts a layer.
A layer file contains the same information as an internal layer (such as a layer in the ArcMap table of contents), including the selection of features.
To create a layer file, you can use the Save To Layer File tool. In ArcMap, you can right-click the layer in the table of contents and click Save As Layer File.
For any tool that accepts a layer, you can browse to a layer file (.lyr) on disk just as you would browse to a dataset on disk. However, when you browse to a layer file, some tools are unable to determine the type of data contained in the layer file and will show you all layer files. If you choose an inappropriate layer file, the tool will display an error or warning.