0

I am trying to iterate a series of feature classes (polygons) from two different/separated folders in model builder to convert a series of polygons using union and then the output for aggregate polygon tool. However, I am having an issue with the input file names. I have to match each entry with part of their names which are sharing a map#. In example both files are sharing map number like orange001 and apple001 or onion002 and banana002. I need help on matching the name of each file entry and reading it as input for my model to create a desire output. I used 2 models as subtype and type which I can use the subtype and read the 1st file from my first folder and then I have to match its name with 2nd entry and grab the shp file and continue my work.

  • 1
    Although ModuleBuilder has iterators, this operation becomes much more complex in ModuleBuilder than a standalone python script. Are you open to python/arcpy script answers? – artwork21 Mar 7 '16 at 17:33
  • Yes. quick question, Can I use conditions in model builder to evaluate the name from both entry and comparing both file or there is no way. If yes please let me know. Thx – Koush Mar 7 '16 at 20:40
2

Here are some general steps to do this via python/arcpy:

  1. Use my answer in this Q/A (see link below) for understanding how to find like name feature classes. For your case the logic will be slightly different since you will need to walk through two different directories. You will need to nest one walk statement/loop within the first walk statement/loop (one looking at the one dir and the other looking in the other dir).

Selecting features based on similar name

  1. After you have the two found layers assigned to different variables, insert those into the Union method (link has a arcpy code sample). Since this is geoprocessing tool, I would suggest to use in-memory workspace for the union layers
  2. Finally, reference the output union layer into the Aggregate method (link has a arcpy code sample)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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