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?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Mar 6, 2013 at 10:28

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")
    
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
answered Mar 6, 2013 at 13:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.