English

How To: Batch delete features after running a process in ModelBuilder

Summary

When running geoprocessing tools in ModelBuilder, sometimes intermediate features not required for the analysis must be removed. Deleting unnecessary features can save machine storage space and clear the workspace from clutter. However, it is not possible to manually batch delete features in the Catalog window. It is also time-consuming to delete features manually especially if many features are involved.

Procedure

Choose one of the following methods to batch delete features, depending on the need.

Use the Delete Intermediate Data function
To delete unnecessary feature classes after running a model in ModelBuilder, click the Model menu and click Delete Intermediate Data. Check if the data is deleted in the Catalog window.

Use the Iteration and Delete tools
If it is necessary to delete some intermediate features, use the Iteration and Delete tools in the ModelBuilder window. After running a process in ModelBuilder, open a new ModelBuilder window and insert the Iterate Feature Classes and Delete tools.

  1. Save the output of the process that must be deleted with a keyword appended to the output name. For example, _delete.

    First model

    Output in the geodatabase
     
  2. Open a new ModelBuilder window ModelBuilder.
  3. Click Insert > Iterators > Feature Classes.
  4. Search for the Delete tool and insert the tool into the new ModelBuilder window with the Iterate Feature Classes tool.
  5. Double-click the Iterate Feature Classes feature and set the parameters:
    1. Workspace or Feature Dataset: Select the geodatabase containing the features to be deleted.
    2. Wildcard: Type *delete to delete features with the keyword _delete in the name as specified in step 1.
    3. Feature Type: Leave feature type as blank to select all the item types in the geodatabase.

      Iterate feature classes
      Note:
      For more information on the parameters in the Iterate Feature Classes tool, refer to Iterate Feature Classes.
  6. Double-click the Delete feature and set Input Data Element to the output from Iterate Feature Classes.

    iterate and delete
     
  7. Run the model. The selected features are deleted from the geodatabase.

    Result from the second model builder. The selected features are deleted from the geodatabase.

Related Information