Append will not write values in ModelBuilder for Tabulate Area

1362
5
05-01-2018 02:26 PM
KarenLeu1
New Contributor II

Since Tabulate Area does not work on overlapping polygons, I created a model to iterate through features, run Tabulate Area for each row in the feature class, Collect Values, and then Append it all to a target dummy table with field names pre-defined. The final result is that the identifier text field copies over fine, but all the numeric fields generated by Tabulate Area result in Null values. The weird thing is that if I run Append again (in the Edit mode of ModelBuilder), with the iteration submodel and dummy table (now with the text field populated) already created, the missing Tabulate Area numeric values get filled in. The individual tables generated by Tabulate Area itself are fine. 

This has been incredibly frustrating, and no amount of preconditions seem to be helping. 

I was successful in carrying out this exact same process in ModelBuilder with Zonal Statistics as a Table for a different raster input, and can't figure out why it isn't working with Tabulate Area. 

Any suggestions would be greatly appreciated.

0 Kudos
5 Replies
curtvprice
MVP Esteemed Contributor

I think you are are running into validation issues. Tabulate Area cannot know what the output table schema will be until the tool runs and processes the data, so I don't think ModelBuilder is getting the info needed to set up the field map for Append.  You could make a custom field map with Python in your main model (inside a Calculate Value tool) but there is a point where even the awesomeness of ModelBuilder is not enough to handle the complexity.

Check out the NAWQA Area-Characterization Toolbox - its approach may work a little better for you. (It uses zonal statistics as table, but provides a nice framework for cranking through a lot of data.)

KarenLeu1
New Contributor II

Hi Curtis, thanks for your reply.

Shouldn't a precondition or creating an empty table with anticipated fields solve the issue of field mapping for Append? Or is there more to field mapping than just matching the names and field names?                                                               

I will try out the NAWQA tool, thanks for the suggestion.

My particular issue was resolved by changing the field type of my identifier field from Text to Long Integer. My identifier values are numbers, but I had set the field type to Text because I wanted to be able to append characters to the names later (scrapped that idea for this workaround). I also was then able to just Merge the collected tabulate area tables, instead of creating the dummy table and Appending, in ModelBuilder. 

curtvprice
MVP Esteemed Contributor

The field map gets generated at model validation time not at runtime, so without explicitly creating a field map, it won't work with the inputs on the second iteration. 

0 Kudos
JibrahnKhoury
New Contributor II

Merge worked for me, thanks for posting!

0 Kudos
DuncanHornby
MVP Notable Contributor

Karen,

Have you looked for tools in ESRI codesharing? If you find yourself thinking this should be easy then you can be pretty sure you have not been the first person to think about this problem in the last 2 decades! A quick search threw up these:

Equally you could create a simple model using the Split By Attributes or Feature Selection Iterator feeding into the zonal stats tool.

0 Kudos