What is a routing map?
A routing map shows you the route from a starting point to a destination. A simple example would be calculating a route from your home address to your local supermarket. The map below uses the TravelTime to show the route from Kennington to the UK supermarket, Tesco.
The TravelTime returns routing information between a starting point and the destinations. You can do a departure or arrival search from the search origin to up to two destination points. For example, arrive at London King’s Cross station at 9am or depart at 9am.
The example below shows the shortest route from King’s Cross to the British Museum departing at 9am.
The user could also do an arrival search.
The example below shows the shortest route from King’s Cross to the British Museum arriving at 9am.
The TravelTime platform supports the following modes of transport:
- Public transport
Using routing on TravelTime Maps tool
Try it yourself. Travel door to door using the TravelTime.
Routing can also be integrated into websites as part of a business solution. For example, a cinema chain could use routing on a cinema finder page. The below map uses Time Map and Time Filter, powered by the TravelTime Search API.
In this example, the user can find out which cinemas are easiest to reach. They enter their preferred mode of transport (public transport in the example below) and the journey times to each location is shown. Time Map produces the isochrone shape on the map. Time Filter produces the journey time information in a list on the left side of the page. The below example shows all cinemas within 15 minutes of central London by public transport.
From the map or the list, the user would select their preferred cinema. They would then select ‘directions to here’.
This would provide them with a route.
Time Filter can return travel time and directions for up to 100,000 points from the search origin. Time Filter requires a defined travel time limit of up to 4 hours. This allows it to show only the results that are relevant to the user and to filter out unreachable locations.
How do I code a route?
Before you begin, you first need to request an API key and ID.
The example below shows you how to code a departure search. The point of origin is the centre of London. The destination points are Hyde Park and ZSL London Zoo. The mode of transport is driving. In the example, the departure date is 2018-09-17 and the departure time is 08:00. The request is for travel time, distance and route.
First, you need to create the request.
Then, you need to add locations to your request by entering the geo-coordinates. In this case, we will use 51.508930, -0.131387 as the centre of London, 51.508824, -0.167093 as Hyde Park and 51.536067, -0.153596 as ZSL London Zoo. Take a look at our free geocoder tool if you don’t have lat/longs.
This request has both a departure and arrival search example.
For the departure search, the API returns travel times, route details and fares for public transport. It also shows the distance for other modes from one departure point to up to two destination points.
For the arrival search, the API returns 1 result for this journey within a range of 1800 seconds (30 minutes). This means the user can arrive within a 30-minute window, rather than arrive at a specific time. The API can also return up to 5 alternative results, like on the screenshot below.
The response for this request contains the departure and arrival search results with routes information. Look at the code here.