Feature sets allow features to be entered interactively and immediately used as input to a model or script. This interactive data entry is done through a process similar to editing features inside ArcMap. Similarly, record sets allow tabular or attribute information to be entered interactively and immediately used as input.
Any tool that uses a feature class or table as input also accepts a feature or record set. This means that for any of these tools, the input can be entered interactively by building a simple model around the tool and changing the input data type from feature class or table to feature set or record set.
Using Feature Set and Record Set in ModelBuilder
You can set a variable data type to a feature set in ModelBuilder, but you can only interactively enter features from the model tool dialog box opened in ArcMap. However, record sets can both be set and have their contents interactively entered in ModelBuilder.
Examples of using Feature Set
Feature sets are commonly used in geoprocessing services, as they allow clients to create and input their own features. When creating a model that you wish to share with other professionals, you can modify the input to a feature set and create a geoprocessing package. The consumers of your package will be able to provide interactive input.
Here are some examples of using Feature Set with geoprocessing tools:
- Create polygons to use with the Clip or Erase tool as the clip or erase features.
- Set the observer points for the Viewshed tool.
- Set the point to begin a downstream flow trace using the Cost Path tool.
- Add points to determine nearby features using the Near or Euclidean Allocation tool.
- Create a point to determine the upstream watershed with the Watershed tool.
- Create candidate locations for a new store, then use the Append tool to add the candidates to a feature class of existing store locations. The appended feature class can then be analyzed to determine the impact of the new stores. The model below illustrates one idea for analyzing new locations:
In the example above, the New Store Locations variable is a feature set variable and is used to define the locations of new stores interactively. These newly created features then become one input for the Append tool.
When publishing a geoprocessing service, any feature class or feature layer input parameter is automatically converted to a feature set during the publishing process (your original model is unchanged—only the published model is converted).
Examples of using Record Set
The model below is built around the Geocode Addresses tool. Geocode Addresses uses as input a table containing an address field and ZIP Code field (depending on the type of address locator used). In this model, the input table data type has been changed to a record set. The schema of the record set contains the definition of three fields: Name, Address, and Zip Code. In addition, the Zip Code field has a coded value attribute domain that enables the drop-down list of valid ZIP Codes. When the model tool dialog box is opened, records and attributes can be entered, and the model will create an output point feature class from the addresses entered.
Another use case for using a record set in a model is converting x,y coordinates to point features. The following model is built around the Make XY Event Layer tool. Make XY Event Layer uses as input a table containing x- and y-coordinates and produces a point layer from those coordinates. In this model, the input table data type has been changed to a record set. The schema of the record set contains the definitions of three fields: X, Y, and ID. When the model tool dialog box is opened, records and x,y coordinate attributes can be entered, and the model will create an output point feature class from the x,y coordinate pairs entered.
Feature Set and Record Set schema
A schema defines the attributes and geometry type (point, line, or polygon) of the features or records to be entered. The schema can also define the symbology to use when displaying newly entered features.