Are you a regular public transport user?
Do you rely on public transport to travel to most places including the beach?
If you have answered yes to these questions, then you have most likely used apps such as Google Maps or Moovit to get real-time data on your chosen mode of transport (bus or train).
I have not yet seen an app that shows the real-time position of the vehicle, most of the time you get an estimated time of arrival at a selected stop or station.
Hence, I decided to build an MVP (purely for demo purposes) for a potential app that allows you to get real-time data of a vehicle’s positions and real-time insights on a particular stop.
For this demo, I have limited my scope to buses only. Also, the data is not live but a snapshot in time. Nevertheless, it is enough to show the essential basic functionalities of the ‘would-be’ app.
The viz can be found here.
Now, if you are curious to know how I put together the dataset that powers this viz, read on…
Step 1 – Get your API key
First, you had to register on the Open Data portal of Transport NSW to obtain an API key.
Step 2 – Extract required data from API
Once you have your API key, I could start querying the APIs I needed to complete the project. First, I had to request the locations of buses Realtime Vehicle Positions API. Once I had a bus’ position, I also needed to know where it came from, where it is going and which route it is following. Hence for each bus in the Vehicle position dataset, I had to query its route information (Transport Routes API).
Some serious coding going on here to query the Transport Routes API:
Step 3: Further parsing on datasets and merge
Using the datasets from the above APIs, as well as datasets on Bus stop geo-location and bus stop timetables (that I downloaded as a Zip file from Open Data – Transport NSW), I was able to critical information for the project. For instance, I needed to break down the route information into 3 parts: Origination, destination and ‘Via’ routes. I also needed to create spatial points for all objects, such as buses positions, stops as well as a destination spatial objects. To find out upcoming buses in relation to a selected stop, I decided to use the distance to the destination. There were many back and forth between the vizzing stage and step 3, as I finding new data points to add to make the demo as realistic as possible.
Workflow – Parsing Route Info
Workflow – Calculating distances and other attributes
I have spent many hours on this viz and sacrificed some sleep. But I enjoyed the challenge as I was able to connect it with a real-life application. And I also find out that encountering issues and problem-solving can be fun when you stay calm and take regular deep breaths 😊.