On the Records: A View Behind the Cameras

How we built the red-light camera app. Download the data and build your own — or embed ours as an iframe.

The nightmare .CSV file generated from TxDOT's PDFs.
The nightmare .CSV file generated from TxDOT's PDFs.  Matt Stiles

Our latest data application, which lets you explore red-light cameras around the state, began last week as 363 files in portable document format.

You remember how much we like those, right?

That's the format in which the Texas Department of Transportation collected data on citations and crashes at monitored intersections. Fortunately, though, we were able to extract the data to a .CSV format (see the original here) and then massage that file into something suitable for the app.

Niran, one of our Python wizards, wrote a script and used the Google Maps API to geocode, or assign longitude and latitude coordinates, to each intersection. That gave us precise locations for about two thirds of the camera sites, but the rest had to be added manually. He then loaded the list into our database and used Django to build pages to display the data. Embedded Google Maps with our longitudes and latitudes create the visualizations of each intersection.

The Texas Tribune thanks its sponsors. Become one.

Not everyone is a developer, of course, so we've made the application embeddable as an iframe. Here's what it would like zoomed in on Houston, for example:

Let us know if you need help with the code.

Texas Tribune donors or members may be quoted or mentioned in our stories, or may be the subject of them. For a complete list of contributors, click here.