5

I would like to feed a list of feature classes (only one polygon per feature class, but up to 150 feature classes) into the Union tool in ModelBuilder by using a Feature Class Iterator and the Collect Values Tool.

Unfortunately, it does not work since "Collect Values" only works with Merge, Append, etc.

Does anyone know a workaround or another way to do this?

1 Answer 1

4

You can do this by writing a python script that inserts a list of feature classes into the union tool.

To use this method:

  1. In Catalog create a toolbox
  2. Create a Script tool
  3. Make the input parameter Features Class that accepts multiple values
  4. Copy the code below to a text document
  5. Save the text document and change the extension from .txt to .py
  6. Reference the .py file within the Script tool
  7. Run the Script tool

    import arcpy
    
    myList = arcpy.GetParameterAsText(0).split(";")
    
    unionResult = "C:\\temp\\union.shp" # make sure you have this directory C:\\temp
    arcpy.Union_analysis(myList, unionResult, "ALL", "", "GAPS")
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.