Making TramTracker work on ‘Dumbphones’

Over the years I’ve been using TramTracker on my ancient Nokia mobile phone, until December 2013 when Yarra Trams updated the web version of the service, and rendered it unusable on older devices.

Detail of D2.5004 advertising 'TramTracker'

Unlike other public transport operators, Yarra Trams actually took my feedback on board and released an updated web version of TramTracker a month later, but unfortunately for me, they were not enough to make it work with my ancient WAP only phone.

As a result, I took inspiration from my recent experiments with PTV’s new API, and came up with a simple website to give access to TramTracker data.

Called ‘Jake Junior: TramTracker for Dumbphones’, you can give it a go at http://jakejunior.wongm.com/.

Using 'Jake Junior' to access TramTracker on a dumbphone

Some background

TramTracker first appeared in Melbourne way back in December 2006, with only two ways of accessing tram arrival information: voice or SMS reply. However usage of the service didn’t take off until 2009, when an incredibly well designed iPhone app was released, providing a much more convenient way to find tram stops and arrival times.

Since then additional methods of access have been provided – a mobile friendly website for non-iPhone devices, a ‘webPID’ for desktop computers in 2009, and an Android app in October 2012. Third-party developers have also built their own apps for the TramTracker service – the most interesting one I’ve found so far is TramFinder for Pebble watches!

One thing these third-party apps have in common is their source of tram arrival data – a public API found at http://ws.tramtracker.com.au/pidsservice/pids.asmx. This API isn’t the easiest thing to play around with because it follows the SOAP specification for webservices – a horrible tarball of XML requests being sent back and forth between devices.

Messing around with SOAP isn’t my idea of fun, so I put building my own ‘simple’ version of TramTracker on the backburner, until I discovered that the new version of the TramTracker website was actually using RESTful calls to a backend service that was returning JSON

I was unsure if that version of the API was actually designed for the public to consume, so I posed the question on Twitter, only for the original developer of the TramTracker iPhone app to give me an answer:

With that in mind, I spent a few hours cobbling together some PHP code, with ‘Jake Junior’ being the end result.

How it works

Internally ‘Jake Junior’ is just a single PHP file – you can find the source code at https://github.com/wongm/jake-junior.

All of the HTML is incredibly simple and all of the heavy lifting is done server side – no javascript or images are required. The home page presents a simple TramTracker ID input box and a ‘Go button, which then loads the next three trams for each route passing through the given stop. Where multiple routes pass through a stop, links are provided to allow you to filter by route. Bookmarking a stop is also simple, as the URLs always lead you back to your intended tram stop and route combination.

Stop information and tram arrival times are retrieved using two hits to the TramTracker API: unfortunately it doesn’t combine the two types of data into a single method.

To get the name and direction of a tram stop, I used to the ‘GetStopInformation’ endpoint:

http://tramtracker.com/Controllers/GetStopInformation.ashx?s=1234

And for the arrival times, the ‘GetNextPredictionsForStop’ endpoint:
http://www.tramtracker.com/Controllers/GetNextPredictionsForStop.ashx?stopNo=1234&routeNo=0&isLowFloor=false

By the way – TramTracker ID 1234 is on route 1 in South Melbourne!

Once I had the results of the two API calls as a JSON string, I was able to deserialise the data, do some simple maths to convert the JSON timestamp into a minutes until arrival figure, and then output it all as HTML.

You can play around with the end result at http://jakejunior.wongm.com.

Footnote

If you are wondering about the ‘Jake Junior’ name – the official TramTracker mascot is dog named Jake.

You can leave a response, or trackback from your own site.

7 Responses to “Making TramTracker work on ‘Dumbphones’”

  1. Daniel says:

    And Jake was the name of former CEO Dennis Cliche’s dog.

  2. Andrew says:

    I must make mention of the fast and simple Tram Hunter for android phones. While I have Tram Tracker for android, Tram Hunter is simpler and faster.

  3. scott says:

    I find the estimated arrival times of trams along the 19, 57 and 59 route to be unreliable. For example, often during peak times it will say that the next tram is 2 minutes away, then it suddenly becomes 8 minutes away, 14 minutes away, before the tram turns up 5 minutes later.

    • Marcus Wong says:

      I thnk there is a blackspot in the tram monitoring system through Royal Park – in my experience arrival times for citybound trams on route 55 at the Royal Children’s Hospital jump around all over the place.

  4. Matt says:

    i am a noob at making apps and i used to use tramtracker on my wii and this looks not that user
    friendly but for a wii or dumb phones it is very good

    • Marcus Wong says:

      You’re right about the learning curve for Jake Junior being a bit steep – unlike the ‘proper’ TramTracker apps you have to manually enter your tram stop ID, but given the capabilities of a low end device, there is not much one can do.

Leave a Reply