Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time


What is it

This site is just a little experiment in "web 2.0" mashups. Starting with an XML feed of state-wide traffic incidents from the California Highway Patrol (available at we pull out local incidents and build on them. Hopfully the result is something people find useful.

So what's here?

First we display local incidents and their details, mapping them with the Google Maps JavaScript API. Then we add Google's traffic conditions so you can see at-a-glance what area traffic os like. Then we add live video from Cal Trans so you can actually see the traffic if that's what you want.

Finally, using the ATOM feed, there's a twitter feed at @sactraffic that's fed via

Can I build on your work?

Yes... and no*. There are both JSON and ATOM feeds available at and respectively, that cover the entire state. They can be queried by the following HTTP GET args:

  • center - The CHP Communication Center. This is the broadest level.
  • dispatch - The CHP Dispatch Center. This is probably what you want.
  • area - The CHP Office. The breaks the Dispatch Centers down further into offices.
  • city - If there is a valid location we'll reverse geocode it for something a little more granular than the CHP office.
  • roads - [ATOM only]. Filters the results by a comma separated list of street names.

So, for example, "SAHB" is the Sacramento Center code so will get you all the Sacramento Valley incidents (covering Sacramento, Chico and Stockton dispatches), and http:/ will get you just the Sacramento Dispatch incidents (this is what this site uses).

You can go further, to the area offices so the North Sacramento office incidents would be http:/ and going even further you can specify a city, like Folsom, which will get you http:/ for the incidents actually in Folsom.

Also, if this is your thing, our ATOM feeds use PuSH notifications for near instant updates.

Note: Only one of center, dispatch, area or city can be used at a time. That's ok though, there's no sense in combining them as they're hierarchal.

JSON Format

    "Area": "North Sacramento",
    "ID": "STCC.STCC.0347D1118",
    "Location": "SAN MARQUE CIR at WALNUT AV",
    "LocationDesc": "SAN MARQUE CIR at WALNUT AV",
              "DetailTime": " 8:11AM",
              "IncidentDetail": "VEH VS FENCE \/ AND TRASH CANS AND LAWN"
              "DetailTime": " 8:13AM",
              "IncidentDetail": "CHP Unit Enroute"
    "LogTime": 1290096688,
    "LogType": "Hit & Run - No Injuries",
        "lat": 38.6003784,
        "lon": -121.346033


The site runs on Google App Engine and since I do this for fun, I have set a pretty low pricing cap. So, please, feel free to use the ATOM and/or JSON feeds as you see fit, just know that if you do and you start seeing 503 Over Quota errors, well, you might want to think about paying my hosting bills.

What you need to set this stuff up. runs on Google App Engine and is written in Python so at a minimum you'll need the App Engine SDK to run your own traffic site based on SacTraffic.

A note about JavaScript compression

JavaScript compression is done via Google Closure. Running make at the root level of the project will build the compressed files.

Legacy LAMP version

The older Apache/Perl version of the code is available at the lecacy-lamp-version tag.