Working with layers and table views

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.

NoteNote:

Any tool that operates on a table will also operate on a feature class or feature layer. This is because feature classes are simply tables with an attribute containing the shape of the feature. In all other respects, they are a table.

When you open a tool dialog box in ArcMap or enter a tool name in the Python window, the following occur:

  1. 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?
  2. 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 is built of the matching layers 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.

Related Topics

11/18/2013