Show Navigation | Hide Navigation
You are here:
Geoprocessing > Automating your work with models > Using ModelBuilder

Feature sets and record sets

Release 9.2
Last modified November 9, 2006
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Using ModelBuilder"


Related Topics

You can create a model tool that allows the user to interactively create features or records as tool input. To do so, create an input variable of data type Feature Set or Record Set, set its template schema and symbology properties (Feature Set only), and make the variable a model parameter. When the model is run from its dialog box, you'll be able to interactively create the input features or records for the tool.

Applications where this interactive functionality is useful include:


For example, you might want to create a tool that allows a user to interactively define in the display the clipping polygon or polygons that will be used to clip input features. This means the user doesn't have to create a new feature class and initiate an edit session to create the clipping feature or features before running the Clip tool.

Interactive feature input control
For any geoprocessing tool that uses features or a table as input, you can exchange the feature or table input parameter for an interactive input parameter that allows the user to create the features in the display or to add the records that they want to use as inputs to a tool.

Creating a model tool to allow interactive input


To allow interactive input for a tool, you must create a model, that includes the tool you want to run using interactive feature input, then create a variable of type Feature Set (for feature input) or Record Set (for table input) that is used in place of a regular input feature class or table. By importing the schema and symbology for the Feature Set or Record Set variable from an existing layer, feature class or table, then setting the Feature Set or Record Set variable as a model parameter, when the model tool is opened from its dialog box, the interactive features or interactive records control will be exposed as an input parameter for the tool.

Before performing the steps to create the model tool, make sure you have an existing layer, feature class, or table from which you will import the schema and symbology (Feature Set only) to the Feature Set or Record Set. For features, you should make sure the schema of the existing feature layer or feature class is of the correct type (point, polyline or polygon), depending on the type of features you want the user to be able to draw in the display as input features to the tool. For example, if you want to use a Feature Set for the input clipping polygon, make sure you import the schema of a polygon feature layer or feature class. As well as importing the schema, you also import the symbology. So if you want your interactive features to be drawn in a particular color, or with a particular hatch symbol, you should create a layer using the symbology you want to import.

NOTE: The schema and symbology is taken and imported into the model. There is no reference to the original data once it is imported.



The following steps outline the process for creating a model tool that allows interactive input:
  1. Add the tool or tools you want to run using interactive input to a new model. This could just be one tool, or a number of tools strung together.
  2. Right-click the model diagram and click Create Variable.

  3. Creating a variable

  4. Select Feature Set as the variable's data type if you want to create an interactive feature control, or select Record Set if you want to create an interactive table record control, and click OK.

  5. Setting the data type for a variable

  6. Right-click the Feature Set (or Record Set) variable and click Properties.

  7. Accessing the variable's properties

  8. Click the Data Type tab and make sure the Select data type dropdown is set to Feature Set (or Record Set).
  9. Set a template dataset to apply to the features or table records that the user will create for the Feature Set or Record Set. The type of feature (point, polyline or polygon) and the symbology available to the user in the model tool's dialog box is based on the template feature class schema and symbology specified here. For table records, only the schema applies.

  10. If you have a layer in the table of contents that contains the schema and symbology you want to apply to your Feature Set, click the dropdown and select the layer. Similarly, if you have a table containing the schema you want to apply to your Record Set, click the dropdown and select the table. Alternatively, click the browse button to navigate to a location on disk to import a layer file, a feature class or a table. If you import a layer from the table of contents, or a layer file from disk, you can take advantage of the symbology that is set. This is useful if you want the user of your tool to draw features using a particular color or pattern, for example, a hatch pattern for input clip polygons.

    Remember that the schema and symbology is taken from the data and imported into the model where it is stored. There is no reference to the original data once it is imported. Changing, for example, a layer's symbology after it has been imported into the model for a particular Feature Set variable, will have no affect on the imported schema and symbology. The Data Type tab will always list the last schema and symbology that was imported.

    Setting a variable's data type, schema and symbology

  11. Double-click the tool in the model to set its parameter values. Set the Feature Set or Record Set as the input for the tool. In the case of a tool such as Clip, the Input Features should be set to a feature layer or feature class (point, polyline, or polygon) that you want to be clipped. The Feature Set variable should be set as the value for the Clip Features parameter. In this case, the schema set for the Feature Set was a polygon feature layer.

  12. Setting parameter values for a tool

  13. Rename the input and output variables to be the names you want for labels for the parameters on your model tool's dialog box.

  14. Renaming input and output variables

  15. Set model parameters for the input and output variables by right-clicking each one and clicking Model Parameter.

  16. Setting model parameters

  17. Save and close the model.
  18. Make sure that the parameters are ordered in the way you want them ordered on the tool's dialog box. For example, you may want the Input parameters at the top of the dialog box and the output parameters at the bottom. Right-click the model in the ArcToolbox window and click Properties, then click the Parameters tab. You can change the order of how the parameters will look in the dialog box by clicking a parameter and clicking the up or down arrow.

  19. Ordering parameters on the dialog

  20. Double-click the tool in the ArcToolbox window to open its dialog box.

  21. Opening the tool's dialog

    The tool's dialog
    For interactive feature input, the user of your tool clicks the Add feature button (Add point feature button, Add line feature button, or Add polygon feature button depending on the data type) then draws the features they want to use as input in the display. In the example, the user draws the polygons that will be used as the Clip features to clip portions of the input features.
    For interactive record input, the user clicks the Add record button Add record button, then types the values for attributes.

    Adding features interactively

    Once all the desired input features are drawn, or input records are added, and the tool is run, the interactively created input features or records are used to create the tool's result.

    NOTE: It is not possible to write to a Feature Set, so if you want to allow interactive features or records as input to tools such as Near or Calculate Field where the output is the same as the input (derived data), add the Copy features or Copy rows tool to the model and connect the Feature Set or Record Set variable as input to that. Connect the output from the Copy features or Copy rows tool as input to the tool you want to run on the Feature Set or Record Set.



    NOTE: The feature set and record set parameter control are disabled in tool layers.



    There are some useful tips and tricks to know when adding features interactively, such as using the tools on the Draw toolbar, entering coordinates to draw features in a specific location, entering a specific radius or area for a circle, and adding input features that were drawn interactively back to the display after the tool is run.

    Learn more about using the interactive feature and record input controls

Altering an existing model to use interactive feature or record inputs



You may have an existing model tool that you want to modify to use interactive feature or table record inputs. The first example below explains how to alter an existing model to allow interactive input features. The second example explains how to alter an existing model to allow interactive table record inputs.


Example 1: Altering a model to allow interactive feature input

A model tool calculates the least-cost path across a landscape using a starting point and a destination point layer as inputs. This model could be made more user-friendly by allowing the user to interactively enter these two points.

Model tool that could be modified to use interactive feature inputs

Model that could be adapted to use interactive feature inputs

The followings steps outline the process to alter your existing model to allow interactive feature inputs:


  1. Right-click the input variables in your model that you want to set as interactive feature inputs, and click Properties.

  2. Accessing the properties for a variable
  3. Click the Data Type tab and set the data type to Feature Set. This is the data type that will expose the interactive feature input control on your model tool's dialog box. Import the schema and symbology that you want to apply to the features that will be added interactively. This could be the layer that was attached as the original input.

  4. Changing the data type for the input to Feature Set
  5. Save and close your model and open the model tool's dialog box by double-clicking the tool in the ArcToolbox window. The user of your tool can now interactively enter the input features for your tool.

  6. A model tool created with an interactive input feature control


Example 2: Altering a model to allow interactive record input

A model tool that takes a table with XY coordinates in decimal degrees and converts the coordinate values to points that are buffered and placed on a map could be made more user-friendly by allowing the user to input the XY coordinates interactively for each record.

A model tool that could be modified to accept interactive table records

A model that could be modified to accept interactive table records
The following steps outline the process to alter your existing model to allow interactive record inputs:


  1. Right-click the input variable in your model that you want to set as interactive record inputs, and click Properties. This is a table that is an input for a tool in your model.

  2. Accessing the properties of a variable
  3. Click the Date Type tab and set the data type to Record Set. This is the data type that will expose the interactive record input control on your model tool's dialog box. Import the schema of an existing table that you want to apply to the records you add interactively.
  4. This could be the table that was attached as the original input. The schema chosen determines the fields that will be available for each record added.

    Setting the data type of the variable to Record Set

  5. Save and close your model and open the model tool's dialog box by double-clicking the tool in the ArcToolbox window. The user of your tool can now interactively enter the input records for your tool and assign attribute values using the attribute editor window.

  6. A model tool that allows interactive table record inputs

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.