Model Builder: Calculating Attribute in Polygon Based on Point Values within

2054
14
Jump to solution
05-11-2021 07:22 AM
KJVersar
New Contributor II

I am trying to iterate through a set of polygons and for each polygon select the points in another feature class which fall within.  Once those points are selected I want sum the values of one of the point attributes and add that sum to an attribute field in the polygon.  Everything seems to work except if no point falls within the polygon instead of 0 the field in the polygon attribute is filling to 1.  I have tried various preconditions and the field value Null is set to 0 but this keeps occurring. Attached is a copy of the current model.

0 Kudos
14 Replies
KJVersar
New Contributor II

But I do want to Sum ART_COUNT from the GS table and put the Sum in the TOT_GS field. TOT_GS is just 0s right which needs the sum of ART_COUNT of all intersecting GS points. Does that make sense?

0 Kudos
DavidPike
MVP Frequent Contributor

OK to save this getting muddled just do this:

add a new field using the + icon -> name the field whatever you want. on the right hand side Add Source and set that to ART_COUNT and click 'add selected' set the merge rule to SUM. keep all the other fields as original default.

 

then run

0 Kudos
KJVersar
New Contributor II

Did that, as attached screen shot, added field GSTEST, which came out as NULL...

0 Kudos
DavidPike
MVP Frequent Contributor

you may accidentally have a selection on a layer?

Should be One to one not one to Many? that seems like the issue.

If doesn't work,  just try with all the defaults, and don't add a new field or change anything except for changing the merge rule.

KJVersar
New Contributor II

Ahhh, I think it was the one to many that was the issue.  Thought to use that since there are multiple GS points within a cell but it looks like I don't need it.  Thanks for your help!