# Demo: live bus/congestion visualisation

**URL:** <https://opendataforum.transport.nsw.gov.au/t/demo-live-bus-congestion-visualisation/756>\
**Category:** Brag\
**Created:** [April 20, 2017, 5:02am UTC](https://opendataforum.transport.nsw.gov.au/t/demo-live-bus-congestion-visualisation/756 "2017-04-20T05:02:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timbennett](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/timbennett/32/226_2.png) [@timbennett](https://opendataforum.transport.nsw.gov.au/u/timbennett)\
**Post date:** [April 20, 2017, 5:02am UTC](https://opendataforum.transport.nsw.gov.au/t/demo-live-bus-congestion-visualisation/756/1 "2017-04-20T05:02:56Z")

</div>

Video capture of something I’m working on: [sydney\_buses](https://streamable.com/ta6q3)

Each dot is a bus. Colour is based on traffic conditions, from moving freely (dark blue) to heavily congested (white). This is based on a short slice from yesterday but I’d like to do a full 24 hour period, and include trains. It’s made in [Processing](http://processing.org) (adapting [these examples](https://github.com/juanfrans-courses/DataScienceSocietyWorkshop)) with about 45 minutes of live position data from yesterday.

Goals:

- Do a full 24-hour cycle
- Add basemap tiles
- Add pan/zoom interaction
- Add timeline control
- Add toggle for colour scheme between speed, congestion and passenger occupancy
- Add colour scheme tweening so the colour doesn’t change abruptly at the end of a trip segment

---

<div class="post-metadata">

**Author:** ![hraftery](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/hraftery/32/167_2.png) [@hraftery](https://opendataforum.transport.nsw.gov.au/u/hraftery)\
**Post date:** [April 24, 2017, 10:36am UTC](https://opendataforum.transport.nsw.gov.au/t/demo-live-bus-congestion-visualisation/756/2 "2017-04-24T10:36:56Z")

</div>

Nice. How do you determine “congestion”?

---

<div class="post-metadata">

**Author:** ![timbennett](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/timbennett/32/226_2.png) [@timbennett](https://opendataforum.transport.nsw.gov.au/u/timbennett)\
**Post date:** [April 24, 2017, 10:47am UTC](https://opendataforum.transport.nsw.gov.au/t/demo-live-bus-congestion-visualisation/756/3 "2017-04-24T10:47:25Z")

</div>

Congestion is one of the fields the API returns. The formula is given here on page 49: [https://opendata.transport.nsw.gov.au/sites/default/files/TfNSW\_GTFS\_Realtime\_Buses\_Technical\_Doc.pdf](https://opendata.transport.nsw.gov.au/sites/default/files/TfNSW_GTFS_Realtime_Buses_Technical_Doc.pdf)

It appears to compare current average speed against long and short term average speed, though the description is a little vague.
