This project became Mapumental. Please visit that site for details of our travel-time maps services.
The work was funded and supported by the Department for Transport.
See also: the main travel-time maps report.
——————
Introduction
After seeing our travel time maps (original report from 2006
and the current report), the next thing that everyone asks is “can I have one for my journey to work?”. We investigated in detail two ways of providing real time versions of these maps, and we suggest a third way
which requires new data.
Better screen scraping
Suppose we want to create a time contour map of journey time to work by 9am for any selected postcode in the UK. How long this takes depends on where in the country the map is centred. In particular, it depends on the density of bus stops and railway stations. First, some background explanation.
Basic screen scraping
“Basic screen scraping” is the technique which we used to generate the example travel time maps which you’ve seen. This was done by “screen scraping” the Transport Direct website. That is, writing a computer program which operated the normal web interface of the site to calculate journey times between lots of points and the destination postcode.
The obvious thing to do would be to fetch the journey between every single point on the final diagram and the destination postcode. However, this would involve far too many queries. Instead we only queried for the journey between every public transport stop and the destination postcode. We then used our own replication of part of the Transport Direct algorithm to calculate the journey time from a specific point to the destination postcode. This is done by adding the walking time to the appropriately nearest/fastest public transport stop.
So, we have the journey time from every point to the destination postcode. This takes a long time to generate, as the query to the website for each journey takes 8 seconds. For example, there are about 1,900 public transport stops in a 20km square around Cardiff central railway station. That makes in total about 4 hours and 15 minutes for Cardiff. From that point on, the contour maps are fairly quick to produce.
This table shows the calculation time:
City | Public transport stops in 20km square (approx) |
Basic screen scraping Generation time (estimate) |
---|---|---|
Cardiff | 1900 | 4 hours 15 mins |
Edinburgh | 2700 | 6 hours |
Birmingham | 6600 | 14 hours 45 mins |
London | 10100 | 22 hours 30 mins |
Parallel screen scraping
The slow generation time was not a problem for making a few maps. However, we would very much like to be able to offer everyone who wants it their own map. Things can be sped up a bit by running parallel screen scraping processes, to make fuller use of the Transport Direct servers. We ran brief experiments at 3 o’clock in the morning to measure this without affecting other users of the service:
Number of parallel screen scrapers | Wall clock time Transport Direct takes to deal with each query(approx) | Average time between query responses from any process (approx) |
---|---|---|
1 process | 8 seconds | 8.00 seconds |
2 processes | 11 seconds | 5.50 seconds |
4 processes | 14 seconds | 3.50 seconds |
8 processes | 17 seconds | 2.13 seconds |
16 processes | 25 seconds | 1.56 seconds |
32 processes | 40 – 50 seconds | 1.40 seconds |
64 processes | 110 -120 seconds | 1.79 seconds |
As you can see, if we use too few processes, we are not making full use of the servers. If we use too many processes, we overload them, and things get slightly slower again. The optimum is somewhere near 32 processes. Roughly, it takes about 1.5 seconds per query. This is over 5 times quicker than using basic screen scraping:
City | Public transport stops in 20km square (approx) |
Parallel screen scraping Generation time (estimate) |
---|---|---|
Cardiff | 1900 | 47 mins |
Edinburgh | 2700 | 1 hour 8 mins |
Birmingham | 6600 | 2 hours 45 mins |
London | 10100 | 4 hours 12 minutes |
Smarter algorithm
The times above are still not quick enough, even though they would fully load the Transport Direct servers.
We can make our algorithm slightly smarter.
It takes only slightly longer when requesting a journey to also get the route, including which bus stops and train stations you change at, and how long each leg of the journey takes. This will give you the destination time at intermediate points, which you then do not have to separately query.
We estimate that this will speed things up again by a factor of at best 5 times, and probably about 3 times. This means Cardiff will take about 15 minutes to generate.
Clearly, a faster source of data is needed than the Transport Direct website.
Using RailPlanner
One way to speed things up is to run an application on the user’s desktop, which has all the data available. We created such an application, based upon the Rail Planner software for Microsoft Windows. Rail Planner can very quickly return a train journey given start, destination and arrival or departure time.
Here is a screenshot of our application, which runs on top of Rail Planner.

© Crown copyright. All rights reserved. Department for Transport 100020237 2007
After you enter a postcode, it starts immediately filling in the map. It does this by running a copy of Rail Planner separately in the background, and programmatically querying it for journey times. As the data arrives, the contours on the map become more complete. It takes about 10 minutes to generate a complete map of the whole country.
This shows that on a computer with all the routing information for a simpler subset (rail only), maps can be generated reasonably quickly.
Interactive Google maps
All of the above ideas rely on existing route finding. Much better can be done with access to the underlying transport model. The way it calculates routes can then be optimised.
For example, Google Maps has a new interactive feature. It lets you drag end or via points of a route in real time. It is optimised to do this, and uses Google’s cluster of servers, so can calculate 10 or 15 routes per second.
This is maybe 20 times quicker than the above, so it could generate a map of Cardiff in perhaps 2 minutes.
Future
There are two clear options for providing custom generation of transport maps.
Local application
Create a desktop application, such as the rail one above, only including bus and car routes. This would require availability of the underlying timetable data. With optimisation, running on modern computers, it would be able to generate a map in 5 or 10 minutes, with useful intermediate information much quicker than that.
Customised servers
Instead of querying the existing Transport Direct site, create a special service just for generating these maps. It would have access to the same underlying data as Transport Direct, but use it in a more optimal manner for the task.