0

I am using ArcGIS Pro 2.01 for this task.

I have 114 shapefiles (each represents a session of the US Congress) which include every congressional district since 1790. I have added a short integer field to each feature class called "Congress". This field is intended to signify which session of Congress that feature was used for. For example, all 435 features in the shapefile representing the 114th Congress should have a value of 114 for that field.

I am trying to automate the entire process using ModelBuilder. I do understand that this could be done in Python but I would prefer to use the ModelBuilder so that I can teach my high school GIS class how to do this before showing them the code.

Each shapefile contains the Congressional session number at the end of the filename.

Should I try to use the For tool or should I use something like the Iterate Field Value tool?

2 Answers 2

1

To do this I would create a model which iterates field values in one feature class, and then make that model a submodel of another model that iterates feature classes.

The help for this is at:

It is much easier to do in ArcPy.

4
  • I will definitely look into the scripting option but I would like to be able to associate the visual nature of ModelBuilder with my students. At first glance it appears that it is not possible to run two iterators at the same time in the same model as one is greyed out as soon as the other is set up.
    – SteveC
    Feb 19, 2018 at 2:36
  • 1
    Exactly, that is why I think you need one iterator in your submodel, and the other in your model (that contains the submodel).
    – PolyGeo
    Feb 19, 2018 at 3:13
  • Looks like I need to spend some more time learning ArcPy.
    – SteveC
    Feb 19, 2018 at 3:25
  • We've had lots of ModelBuilder questions on incorporating submodels if you are looking for help doing that.
    – PolyGeo
    Feb 19, 2018 at 3:37
1

I was able to work through this using ArcPy:

  1. Created an array called "CD_List" containting filepath names for all 114 feature classes. This was simple enough to create in Excel with the CONCATENATE formula.
  2. Used a for loop to iterate the process with the Calculate Field Tool:

for x in range (0, 113): arcpy.CalculateField_management(CD_List[x],"Congress",(x+1),"","")

Your Answer

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

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