ModelBuilder: How to input specific area values of multiple new shapefiles (39) into a table to Excel

710
1
10-08-2018 10:40 AM
TiffanyWu2
New Contributor

Hello everyone! I am new to this community but have found a lot of the answers extremely helpful.

I've created a main model on ArcGIS Desktop with five submodels nested in it. I'm on my final step and hoping this is possible to minimize the manual labor in doing my project.

So, I start off with a bunch of country shapefiles (i.e. India, China, Bangladesh, etc.) and I clip them based on a 0/1 binarization. Then I separate them into two different folders and clip them with another shapefile input. Then, for all the new shapefiles created (I believe there's 39 total), I iterate a process where it creates an Area field and calculates the Area for each by using 'Calculate Geometry'.

Now, I would like to put all these tables together for each table, listing specifically: Shapefile Name and Area in KM. Then, the attribute table would ideally look something like this. 

... and so forth. Is this possible to do in ArcGIS?

Then, after there's a separate table for all of the shapefiles and their areas, I would like to export that exact table to Excel. I know that that's probably the easier part, but I'm wondering how I can nicely organize the areas with each shapefile before putting it into Excel, to minimize manual work.

Please let me know if there are any solutions. I would love to answer any clarification questions if needed.

0 Kudos
1 Reply
JakeSimms1
Esri Contributor

With out looking at the data you would need another iterator (which is not permitted in the same model) to capture the names of the shapefiles using in-line variables then use a field calculator to populate a field for the country name.

I have spend some time working on your issue with my own sample data yet have been unable to successfully utilize model builder with a single iterator. If you do this process over and over I would say the best way is to run your created model then utilize another model that iterated the 39 shapefiles to append a feature.

In my test case I have a folder workspace names States which holds all my states shapefiles. The Iterator goes through each feature class adds an Area (float) field and calculates the area. Then adds a State_Name (text) field (you could use countries) which the Field Calculator uses the Iterator's Name object to use inline variables to take the shapefiles name and insert it into the State_Name field with with Field Calculator. You could do all of this in your model. 

To reiterate, this part of the tool would basically create a new field in each of your 39 country features and put the name of that feature in the field.

Model 1:

Field Calculator (Insert State Name)  for adding shapefile name into new field using the Iterator and in-line variables:

I created a new feature (State_Schema) as a template with the fields I wanted. I will use the Append tool to append that blank feature with all the values from all the state shapefiles. In a second model, created because I need an additional Iterator, I  go through that same folder of State shapefiles using an iterator to Append the State_Schema then used the Table to Excel tool to export.

Model 2:

If you have questions, reach out.

0 Kudos