7

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.

3
  • Might you be interested in using python and not doing this in the field-calculator?
    – djq
    Commented Dec 15, 2011 at 17:56
  • @celenius I'm most interested in finding a way to do this purely through the ArcGIS UI. I had considered writing a standalone Python script that would essentially iterate through each ID in the table and output the summed values to a new table, which would be fairly simple, but I am hoping to find a short code snippet that allows for this to be done in the Field Calculator -- or possibly even a ModelBuilder method -- that doesn't require the creation of a new table.
    – nmpeterson
    Commented Dec 15, 2011 at 18:03
  • Yes - I was thinking of the same approach that you describe for a standalone script. I haven't figured out how to examine sections of the attribute table from within the UI; I await answers with interest!
    – djq
    Commented Dec 15, 2011 at 18:09

1 Answer 1

6

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.

3
  • Great solution! Summary Statistics is a nifty tool :)
    – nmpeterson
    Commented Dec 15, 2011 at 19:00
  • 1
    The only caveat I would mention here is if versioning is involved. If so, creating a view from the DBMS side on a versioned table will cause the view to look at the "base" table and not include later revisions. A multiversioned view can be used in that case, though there is a performance hit for using it. Commented Dec 15, 2011 at 19:37
  • @Michael, very good point! Thanks for adding your experience to this answer. Commented Dec 15, 2011 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.