Posts tagged ‘sactraffic’

Traffic on Twitter

Now here is a good use of Twitter (IMHO): Sacramento Traffic Updates

Unbeknownst to most people the CHP makes available a dynamically generated XML file of all their working incidents state-wide. Borrowing a page from the LA Fire Department, it struck me that using this feed for updates to Twitter would pretty slick.

So @sactraffic was born.

I of course made it configurable so I can set the “Center” and “Dispatch” that I want (in case I get a hankering for “FresnoTraffic” I guess) and then I found that at least in the Sacramento area there are still a lot of incidents so I further added configurable filtering on the “Area” (as in “just give me ‘Sacramento’ and not ‘Placerville’ or ‘Auburn’”).

Then I went and filtered all those nifty CHP shorthand acronyms, “JSO EB ONR” (just south of east bound onramp) and low and behold actually readable alerts.

I was (and still am) concerned that hitting that XML file every 5 minutes is unnecessary traffic and load, I would rather not grab the whole file if it hasn’t changed. I was surprised to find out that the file seems to be generated on the fly on every access as both the Last-Modified and Etags headers apparently update on every access regardless of any changes. And they look like they don’t use compression either. Seems to me that the CHP itself is not worried about excess traffic or load.

This whole exercise took about an hour, give or take, and then a few minutes here and there for tweaking, and of course writing this blog post.