Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick
brad

hacking tripcheck

I figured my final Oregon hack should be Oregon-related, so here it is.

The Oregon Department of Transportation has this website, TripCheck which updates almost in real time this file showing Portland traffic conditions:

http://www.tripcheck.com/images/SpeedMap.gif [mirror]

I've been fetching that graphic every 10 minutes for the past 2 months, so I decided I wanted to analyze them now.

Ideally I'd deduce:

* each polygon, from the series of images
* stats about each polygon:
.... frequency of red/yellow/green per (day-of-week,time-of-day)
.... overall best/worst areas,

Well, I only made it part-way through the first step tonight. I wrote a couple little programs which collectively calculate color histories for each pixel and then group them. The idea being that sets of pixels with the same histories are part of the same polygon.

It mostly worked, but you'll immediately notice the first picture has two non-adjacent road sections marked as one. That's just because I forgot to run the group visualizer on the full pixel histories, and the limited set I ran it on always had a perfect correlation between those road sections. Fixed. Re-uploaded.

More disturbing is the little chunks of black in the purple. I'd look into it but I'm so tired.

I also need to remember/find the algorithm to make a bounding polygon around a set of points. Then I can do some client-side imagemap with some onHover stuff doing XMLHTTP requests to a server returning stats per road sections.

But I'll probably never finish this. It entertained me for the evening, though.
Tags: img
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 13 comments