Getting Started


Introduction

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.

Audience

This documentation is designed for people familiar with JavaScript programming. You should have experience in programming web based applications.

Hello World

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:

  • documentation for the API request you want to use
  • any reference information you need e.g. bus stop ATCO code
  • HTML editor to create the web page.

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.

Step 1

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.

Step 2

Here are some Transport API request examples in London that are worth trying replacing the URL in the example above:

Step 3

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

Have fun!