[ Content | Sidebar ]

Sydney Traffic

Results of a little bit of weekend hacking...
http://twitter.com/sydneytraffic

It parses / screen scrapes the Sydney RTA's traffic reports, does some text substitution in an effort to get the event text under the twitter 140 character message limit and automatically posts the updates. The idea is that one could then subscribe to sydneytraffic on twitter and receive SMS updates of the latest traffic situation.

Strangely, the RTA don't provide an XML / RSS / Atom feed or anything sensible for these updates, so it was a bit of a challenge to strip out the relevant information from the table heavy HTML. I'm going to continue making improvements and updates to the text substitution and shortening, but it's basically functional now.

UPDATE: Source at http://bitbucket.org/akent/sydneytraffic

18 February 2008

17 Comments

Write comment - Trackback

  1. Comment by Julian Ridden

    Brilliant stuff! Hate to think how much work this took, but it certainly seems to work well at this point. Ill keep checking back here for updates.

    11 September 2008 @ 9:02 am

  2. Comment by josh909

    Just stumbled across this... Great work! It's disappointing (though not surprising) that organisations like the RTA don't have the initiative to do this themselves. Again, top work!

    01 October 2008 @ 8:37 pm

  3. Comment by Dean

    Just found this aswell, and loving it!

    Any chance of using your methods to report on cityfrail disruptions?

    31 December 2008 @ 7:28 am

  4. Comment by Adam Kent

    Dean (and all) thanks. For Cityrail there is http://twitter.com/sydtrainservice ... More info here.

    31 December 2008 @ 7:55 am

  5. Comment by Kelvin Nicholson

    Interesting little project! It would be pretty cool if there was a service that allowed you to lookup coordinates via street addresses, and you could do a daily map of incidents.

    Anyways - as there aren't any XML feeds to consume, are you just scraping the page with BeautifulSoup (or something else)?

    Nice work!

    13 January 2009 @ 9:36 pm

  6. Comment by scatsboy

    Just found this - interesting.

    We'll see what we can do to make this info a little bit more accessible.

    We'll also keep an eye on this forum for your comments and suggestions.

    No promises (of course), but we will consider your thoughts.

    25 March 2009 @ 12:07 pm

  7. Comment by Phil

    Great service. Amazed at home many incidents there in any one day. The downside of which is the feed overloading my twitter account.

    What's the possibilty of segmenting the information into seperate feeds? CBD, North Shore, Inner West etc...

    Currently I feel like I'm suffering from Too Much Information™

    15 April 2009 @ 1:02 pm

  8. Comment by Adam Kent

    Hi Phil. I agree, the number of daily incidents is quite remarkable. You might be interested in checking out the separate "area" feeds:

    http://twitter.com/sydtraffic_city
    http://twitter.com/sydtraffic_nth
    http://twitter.com/sydtraffic_sw
    http://twitter.com/sydtraffic_nw

    15 April 2009 @ 1:08 pm

  9. Comment by abe

    Great idea!

    Did you guys have to ask permission from the RTA to reproduce their content..?

    27 May 2009 @ 3:03 pm

  10. Comment by Adam Kent

    @abe: I have not asked the RTA for explicit permission, no, but I think scatsboy above in comment #6 is somehow affiliated with the RTA so I'm taking that as implicit tolerance. Also there are a few other sites that seem to use the same data, check out http://prangz.com and http://www.traffichawk.com.au

    27 May 2009 @ 7:46 pm

  11. Comment by Adam Kent

    Belatedly @scatsboy, thanks for the feedback. When the data format changed in June 2008 that made life a lot easier. To be honest, the screenscraping solution is working pretty well right now, so I'm disinclined to change what's working, as long as the RTA is happy with the bandwidth overhead! I try to be quite polite with the polling though, only every 5 mins in peak hours and every 20 minutes other times.

    27 May 2009 @ 7:49 pm

  12. Comment by Dave

    Also a heads up on http://snarl.com.au. Launching this week. Starting in Sydney and moving all around the country.

    05 June 2009 @ 12:19 am

  13. Pingback from Bus and car meet on George and Liverpool | Leefe rates the world...

    [...] Can’t seem to find any mention of the incident on the RTA Sydney traffic reports. Which, I find, have been usefuly turned into twitter feeds: [...]

    15 June 2009 @ 10:07 pm

  14. Comment by Jan

    Are you able to incorporate information from non RTA sources? Would be interested in knowing how to send you any urgent updates on major roadworks happening now on Hills M2 motorway. Would appreciate a response via the email address provided. Twitter address is HillsM2Roadwork

    30 July 2009 @ 10:47 am

  15. Comment by Mel

    Have you thought about including hashtags in each of your Sydney traffic pages - i.e. #sydtraffic. This allows a lot of applications out there to use your Tweets more intuitively. If you are interested in adding this to your code please let me know.

    09 March 2010 @ 9:49 am

  16. Comment by Adam Kent

    @Mel, sure, I have considered adding hash tags, but since tweets are limited to 140 characters I think it's better to fit more of the alert message in there rather than fill up precious space with boilerplate hashtags. If I've misunderstood what you mean though please feel free to expand on your idea more.

    09 March 2010 @ 12:36 pm

  17. Comment by Mel

    Hi Adam,
    Thanks for such a quick response! I understand that tweets are limited to 140 characters. However, if you use a hashtag, then your tweets can be displayed on a map --- which makes your tweets ALOT more visual/effective. For example, traffic applications (e.g. in link below) would be able to find your tweets, analyse them and then work out where to pin them on a map.

    In other words, all of your tweets would be able to be placed on a map -- and users would not have to sort through long lists of tweets to find a traffic jam that "might" be blocking their path home. All of the tweets on Syd North, etc would be combined on a map -- making it easier for commuters to work out where traffic obstacles are. Plus, users who don't know how to use Twitter would be able to get use out of your Tweets... and they would only have to worry about using the application.

    I mean, this Tweet is very detailed and is only 118 chars! --- "Mays Hill: M4 Mtrwy at Coleman St; Hazard: Spillage, Oil; Lanes: Eastbnd; oil spill continues from N4 Notorway Sth onto Woodville Rd". As you can tell, I'm big on intuitive hashtags! :)

    If you want to chat you can also contact me on my email address! :)

    11 March 2010 @ 12:32 pm

Write comment