Creating output table in Model Builder

7600
9
01-12-2012 08:10 AM
XuanLiu
New Contributor
I have tens of thousands of points in a region. I divide the region into
over 2,000 sub-regional zones, and assign a zone ID to each point. I want
to calculate a spatial clustering score of the points in each zone. Using
Model Builder in ArcGIS, I build a model that has two major components:
"Average Nearest Neighbor" tool and "Iterate Feature Selection" tool. It
iteratively selects points by zone ID and calculates Nearest Neighbor Ratio
(NNRatio) for the points in each zone.

The results are just what I need. The problem is that I can only see the
results in the progress dialogue box on the screen with all sorts of
unwanted info (e.g. "processing begins ...") for each iteration. I really
need a way to get a clean output table that has zone ID and NNRatio fields.

I tried "Collect Values" tool. It can collect Zone IDs and NNRatios
(separately), but it doesn't create a file. Again, I can only view results
on the screen, although it is cleaner without all the other info on
processing progress.

Average Nearest Neighbor function has an option to export a HTML report.
But it is HTML, one file for each zone, and with a lot of unnecessary info
and graphics.

So my question is if there is a way to get an output table with zone IDs
and NNRatios.

Any help would be greatly appreciated.
0 Kudos
9 Replies
DanLee
by Esri Regular Contributor
Esri Regular Contributor
There may be different ways of achieving this, but here is a possible way:

Create a table with the two fields, ZONE_ID and NNRatio. (You can use the Frequency tool (Analysis toolbox - Statistics toolset) on the zoneID field of your points to get a table with the zoneID field; then use Add Field to add the NNRatio field).

For each iteration in your model, use Select By Attibute to select a row in the above table by the collected zoneID and then use Calculate Field tool to calculate the NNRatio by the collected NNRatio value.

Hope that gives you some lead.
0 Kudos
XuanLiu
New Contributor
Thank you very much! Looks very promising. But I am stuck with one little thing - where to find "select by attributes" tool for Model Builder? I can find other selection tools such as 'select layer by attributes' but had no luck to find the most popular 'select by attributes' for model builder. Please let me know if you know where to get it. Thanks again!
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
It was a typo; I meant Select Layer By Attribute. Sorry about that. You would need to use Make Table View tool before Select Layer By Attribute if your table is from the Catalog, not from ArcMap table of content. Hope this works as you wanted.
0 Kudos
XuanLiu
New Contributor
Yes. It works perfectly! One modification: I didn't really need "Collect Values" for this to work, as shown in the attaech chart. Thanks Dan, for all your timely help!
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
You are welcome! I am glad to be able to help. You are right, no need for the collect values in this case.

Happy geoprocessing!
0 Kudos
GretchenJohnson
New Contributor
Hello,

I want to do something very similar to this, but I can't seem to get it working. My model selects a feature in a source layer, then uses "select layer by location" to select features from a target layer that have their centroid within 0.5 miles of the source layer. I then use "summary statistics" to sum over one field (in this case population) and "get field value" to grab that value.

The problem I'm running into is creating a table from these values. I want to ensure that the calculated value is added to the correct record. So I created a dBASE table from the "PhaseICorridorsSplitTesting" layer and named it "LandUseAnalysis". I'd like to select the same record in the "LandUseAnalysis" table as was queried in the "iterate feature" function (using the FID/OID fields).  I'm then using "Value (2)" as an in-line variable into the "calculate field" (though I'm not sure if this part is working since the tool stops before it reaches this point).

It looks like that is what you are doing here, but I keep getting an "invalid SQL expression" at the "Select Layer by Attribute" tool. I've tried pretty much every combination: "OID" = '%Value%', "OID" = %Value%, no percent signs, etc. So, I guess my question is, what am I doing incorrectly, and what's going on behind the scenes of the model that you eventually got working?

I have some programming experience but am pretty new to model builder.

Thanks!
0 Kudos
ShitijMehta
Esri Regular Contributor
Hi,
Please can you share your model with some sample data.
You are using 10.0? sp? or 10.1?

Thanks!
0 Kudos
GretchenJohnson
New Contributor
Hello,

I'm sorry I didn't get back to you on this. I never got a notification that someone responded, and I had to move on to a different project for a while. I actually did end up finding something that works, but it's a little complicated (I don't quite understand all the parts yet), so I'm still wondering if there's an easy way to create a table from an iterative model where the the result of the analysis is stored along with the feature ID that the analysis was performed on each time. 

I'm using ArcMap 10.1, and the latest SP, I believe.

I've included my model and some sample data. The target layer data ("residents per acre") was too large to attach. I was just using some simple population by block data from the 2010 Census. Hope this helps.

Thanks!
0 Kudos
MadiThurston
New Contributor

Hey Gretchen,

It's been a few years so this is probably a long shot, but I am trying to do the same process as you were. Do you still happen to have the model or remember what you used? I can't figure it out when it comes to getting each iteration input into the table and one of your models in the folder won't open (maybe due to new Arc versions?). I appreciate your help!

Madi

0 Kudos