I am building a simple tool with ModelBuilder to calculate a density score for projects within a delineated watershed. I am working with two tables: a table of the project points and a table of the delineated watershed. In the watershed table, I have added and calculated a new field for the watershed area in square miles, and also a new field "Project Density Score". In the project points table, I already have selected the points within the watershed polygon with Select-by-Location.
The Project Density Score is Sq Mile Area of Watershed / # of projects within the watershed polygon. I am wondering the best way to calculate this score in the watershed shed table field using the count of selected features from the Project Points table. There is no real way to join the two tables that I can see that would work. Should I use FeatureSetbyName in an Arcade Expression or use Cursors in Python? I'm having trouble figuring out the syntax specifically for making the calculation using the selected features of one table and the area value in a separate table.
Thank you!
you are using modelbuilder and simply dividing one field by another (selections are honored)
Calculate Field (Data Management)—ArcGIS Pro | Documentation
python
Calculate Field Python examples—ArcGIS Pro | Documentation
Hey thanks for responding, this is helpful. I guess the only part I’m stuck on is how to call on a field from another table in field calculator? Like I need to calculate a field by dividing the area in one table by the count of selected features from a different table. I’m not able to join the two tables. Thank you again for the help, really invaluable support around here.
Can't you do a spatial join?
Spatial Join (Analysis)—ArcGIS Pro | Documentation
Spatial joins by feature type—ArcGIS Pro | Documentation
Thanks for following up! Yes, I can do a spatial join and that gets me down the line, but now the final part which I cannot figure out. The new spatial join table only contains project features within the watershed polygon and has a calculated field for watershed area.
There is also a field called "Project_Density_Score" which is the final product. That is calculated by dividing watershed area / # of project points within watershed polygon. I have tried to use some combination of Get Count/Calculate Value/Calculate Field in Modelbuilder, but to no avail. How can I perform this calculation in field calculator? It would be Area / # of rows, but I cannot figure it out, I'm sure it's something remarkably simple.