[GIS] Summing Attributes from a Related Table

arcgis-desktopfield-calculatormodelbuilderpython-parserrelates

I have a line feature class representing road segments, with each road segment having a unique ID. This feature class has an attribute of average observed daily traffic counts. I have another table which contains more information about each road segment, but each road segment ID in the table has 8 entries (each of which corresponds to a 3-hour period).

I've set up a Relate between the feature class and the table, and have added a new field to the feature class that I would like to populate with the sum of 8 values from the table that share the same road segment ID (i.e. one attribute, represented by 8 measurements from different times-of-day).

I'd like to do this using the Field Calculator or Model Builder. Python would be preferred over VBScript.

Best Answer

While this isn't a Field Calculator method, have you considered creating a Database View of 3hr table? You could summarize the 8 entries per RoadID, then create a simple Join data back to the road featureclass, rather than using the relate.

If you are using a RDBMS, you could make a dynamic View through it's internal methods that you could simply Join to the road featureclass. This would keep the tabular summary data always up-to-date.

If you need to do this in a pGDB or fGDB, you could script the process through ModelBuilder fairly easily, although you would need to update the data manually. And by using the "in_memory" workspace, you would also avoid creating a temporary table on disk.

The process I would use would be something like: Input Table-> Summarize data-> Make View (in_memory)-> Join field to shapefile.

Tools you would likely use include:

  • Summary Statistics
  • Make Table View
  • Join Field (ArcInfo) or Add Join (ArcView/Editor)

Read up in the ArcGIS online help for specifics of each tool.

Related Question