Future Cities Catapult have collaborated with TransportAPI to bring you a free version of their data platform. The platform provides travel information based on open data feeds from key industry sources such as Traveline, Network Rail and TfL so that you can to build live data feeds into your information services.
It is a comprehensive open platform for Britain’s transport network. There are currently over 1100 developers and organisations building on the platform which powers transport operator sites and award-winning apps alike. Even the social is covered with Transport Buzz a new product for understanding how commuters feel about their journeys.
The following instructions show how to add a Transport API content link to a web page. This will allow you to add transport information links to any pages you want.
You will need:
These instructions will help you find this information and help you create these pages. This is really aimed at developers but even if you are new to web development you should be able to do this.
Use your HTML editor (can be just a text editor) to design the page where the URL will be displayed. Copy this code to create the simplest unstyled html page possible for the purposes of this tutorial. When this page has all the relevant information added from this tutorial then you need to copy it onto a web server or into filespace where the files are automatically published on the web.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Transport API content</title> </head> <body> <h3>Title for your content</h3> <p><a href="http://fcc.transportapi.com/v3/uk/bus/stop/490012745J/live.html?group=route ">Label for your clickable URL</a></p> </body> </html>
The URL in this example can also be copied into a browser where you will be able to check that it retrieves the data you expect.
Here are some Transport API request examples in London that are worth trying replacing the URL in the example above:
Clapham Junction timetabled train departures September 13th at 12:00 : fcc.transportapi.com/v3/uk/train/station/CLJ/2012-09-13/12:00/timetable.html
Willesden Junction Overground live train departures : fcc.transportapi.com/v3/uk/train/station/WJH/live.html?limit=10
Bus Stop St.John Street (stop J) live departures : fcc.transportapi.com/v3/uk/bus/stop/490012745J/live.html
Bus Stop St.John Street (stop J) timetabled departures : fcc.transportapi.com/v3/uk/bus/stop/490012745J/timetable.html
Bakerloo live departures at Embankment tube Platform 6 : fcc.transportapi.com/v3/uk/tube/bakerloo/EMB/6/live.html
Bus stops near a specified lat/long position * : fcc.transportapi.com/v3/uk/bus/stops/near.html?lat=51.534121&lon=-0.006944
Of course you can also edit the URLs to change the stations/ stops/ lines or times. The last example involves a geo-location. You can use your own. Find a place on OpenStreetMap: move/zoom the map where you want, and copy the lat/long from the URL in the address bar.
Within the URL used in the example above the code 490012745J is an ATCO code that uniquely indentifies the bus stop. Use the Bus API documentation to now substitute the reference data into the URL (replacing the ATCO) to allow you to specify which stop/station data you want to retrieve.
You can look up the relevant codes at the URLs below:
Some of these files are long and complex... you can also search for the codes used for the stations / stops and find many of them on the website placr.mobi