Looking for an online traffic counter I can query with curl
October 28, 2014 2:22 PM   Subscribe

I am searching for a live traffic flow counter which is on the net and reachable by http, or some webpage that displays hourly or cumulative vehicle statistics.

I'm testing data importing into a charting/logging system which is part of a network monitoring system for a metro ISP. Right now I have it working with a brief shell script and local weather data, for example to grab the current temperature:

curl -s "http://aviationweather.gov/adds/metars/index.php?submit=1&station_ids=CYVR&chk_metars=on&hoursStr=2&std_trans=translated&chk_tafs=on" | grep -m 1 "deg;C" | se
d -e 's/\/\./' | sed -e 's/&.*//'

this grabs the webpage, trims it to just the line with the temperature in C, then trims the output, so the output is:

13.0


this is then fed into a charting system for monitoring purposes.


I'm looking for a webpage which can be similarly queried for vehicles per hour statistics, either a realtime counter or a cumulative counter. Doesn't necessarily need to be in my area, can be anywhere in the world, this is for testing purposes.
posted by thewalrus to Technology (4 answers total) 2 users marked this as a favorite
 
i don't have any links, but to aid you in your search, you're looking for a RESTful API with an XML or JSON payload.
posted by hollisimo at 3:00 PM on October 28, 2014


yes, you probably want to google around for a traffic 'api' - lots of results. Here's one that goes just a tad deeper. I'd also suggest you poke around your municipality's public facing servers, as often there are un-publicized open services.

it could be any endpoint that responds to an http request. doesn't have to implement REST, nor does the request or response have to be xml or json. today, most things touted as REST are plainly not. and in the example provided, that's a plain-text response, so likely any old data format will work.
posted by j_curiouser at 3:16 PM on October 28, 2014


I'm not aware of any service that gives volume in number of cars for a given road segment in real time. Illinois has volume data for various roads, but I can't find any rhyme or reason to which ones update regularly and which ones don't here, which gives hourly, and volume, but isn't realtime. If you find a station (try searching for community "chicago"), you can drill down into hour of the day volume counts, but I couldn't find anything less than 2 days old.

Most real time traffic APIs will give you either average speed at a given point, or average travel time from point A to point B. If one of those is acceptable, this is the number of minutes it takes to get from O'Hare airport to the Circle Interchange in Chicago:

curl -s http://www.travelmidweststats.com/Detailed.aspx?selLinks1=24 | grep -m 1 'color: green' | sed -e 's/TAB*<[^>]*>//g'
(where TAB is the literal tab character)

That's reasonably trafficy and will vary to different values of varying frustration throughout the day.
posted by kaytwo at 3:55 PM on October 28, 2014


Response by poster: I think I've found one, not in cars/hour volume, but drive times... such as Bellevue to Federal Way, the current drive time estimate can be used to chart daily rush hour peaks and lulls.

http://www.wsdot.com/traffic/traveltimes/default.aspx
posted by thewalrus at 4:12 PM on October 28, 2014 [1 favorite]


« Older How crazy will this book signing be?   |   Credit impacts of renting a second apartment in... Newer »
This thread is closed to new comments.