Skip navigation

You are in:  Home

Give feedback

Please use the comment form under each blog entry to give us feedback items on blog items.

If your comment is not related to a blog entry, please use the general feedback form.

CycleStreets blog

News from CycleStreets

Lessons from the Developer Day

March 10th, 2010

On Saturday we held an intensive but successful event that focussed on the development challenges for CycleStreets. It was attended by computer scientists, software engineering professionals and webmasters who have experience in managing online services. This summarises some of the stuff we talked about.

Processing OpenStreetMap (OSM) data to build a Graph for Cycle Routing

We began by focussing on how CycleStreets processes OSM data into edges and vertices that can be used by a routing engine.

CycleStreets can find the shortest, fastest or quietest routes according to weightings attached to each edge. For the shortest routes the weight of edges is simply the length of the street between the two vertices. The weighting of the edges for the fastest and quietest routes is more interesting and depends on the type of street, the riding surface, whether there are any traffic lights and if it is going up or down a hill, and other factors going forward.

CycleStreets has its own routing engine that is written in Object-Orientated PHP, this language being a choice purely for legacy/historical reasons that has never been formally reviewed. The space inefficiency of PHP arrays has meant that the CycleStreets routing engine has evolved a suite of techniques for reducing the amount of data exchanged between it and the database.

To make the processing as fast as possible for serving routes live, all the weightings of edges are pre-computed. A data compression technique known as ‘Cello’ (Cellular Optimisation) reduces the number of vertices by a factor of five and the edges by two.

When planning a journey CycleStreets assumes that it needs to look at an area of the map that is up to twice as long as the straight-line distance between the start and finish points. The edges and vertices for that area are extracted from the database and either a Djikstra type or A-star algorithm is applied to produce a route.

Route planning in Central London is the most demanding for the system. An 8-mile journey extacts 22000 vertices and takes 22 seconds to create as a cache in PHP, consuming an unacceptably large amount of memory. It takes a further 2 seconds to search that cache to find a route.

The feedback from this section of the day was that:

  1. There are off-the-shelf programs that can process the whole of the UK in less than a second. Using one of these implementations, we could replace the small section of code that does the actual graph traversal, to get a quick speedup.
  2. The physics of the routing is of the greatest interest to cyclists. That is what makes CycleStreets special, and is where we add value; it is the focus of our innovation.
  3. We need to make it clearer how CycleStreets processes the OpenStreetMap data for cycle routing.

Since the dev day I have had a further look at options for the routing.

Our existing routing engine

At the moment our routing engine exists in two forms: stable and testing.

In the stable form the graph is simply edges and vertices. It has been reliably producing routes for several months, and although in most areas of Britain it can generate routes quickly, it does not work quickly enough in London.

The testing form takes into account the cost of turning at a node and is designed to reduce wiggliness. This has been in development for the last 3 months and has proved complex and difficult to optimise. It has reached the stage where it is nearly ready for release, but has the problem that routing with it takes too much memory.

The key to reducing the amount of data is in reducing the number of edges. In Cello it is quite easy to reduce the number of vertices, but much harder to do that for the edges.

On the developer day we discussed instead how reducing wiggliness could be taken into account by modifying the vertices on the graph, as shown below.

Incorporating the cost of turning into the graph

The cost of making the turn from S towards W,N or E shown on the left. can be incorporated into the graph as shown on the right.

The left of the image shows weighted edges joined in the middle with the costs of making the turn from node S towards each of the nodes W,N and E.The total costs of the routes are: SW = 5 + 4 + 4, SN = 5 + 1 + 5 and SE = 5 + 8 + 7.

That can be transformed into the image on the right, in which the turn costs have become extra edges between the vertices. The extra edges are one-way.

Making such a change to our graphs seems relatively simple compared to debugging Cello. At a vertex an extra edge will need to be added for each of the other edges. In this case 4 x 3 = 12 extra vertices and edges.

This modified graph could then be handled by the off-the-shelf routing engine.

Import of Data from OSM

On the developer day we did discuss how CycleStreets imports data. This summary attempts to clarify the process.

The table of how OSM tags are used by CycleStreets is shown at:

http://www.cyclestreets.net/views/howTagsUsed/

This table is orderd by the numbers of matching ways. The first row shows the most common tag pattern that matches half-a-million ways. The table has a long tail.

The table is built by a procedure involving the following steps:

1. Import

The OSM way tags that are relevant to cycling are identified as the following:

  • highway
  • cycleway
  • access
  • foot
  • bicycle
  • oneway
  • relation

For each OSM ‘way’ a row is created in the map_way_tags database table.
The above tag names are used for the field names in the rows, but suffixed with ‘Tag’, e.g. onewayTag.

The relation tag is only used where the relation it refers to is something to do with cycling.
Usually these are signed cycle routes with tags such as type=”route”, route=”bicycle” and network=”NCN”, ref=”11″.
Some ways are tagged directly with e.g. ncn_ref=”11″

Node tags such as crossings and traffic_signals are handled by later processing.

2. Canonization

The values of the tags are checked against an allowed set of values that CycleStreets recognizes.

Where there are invalid values some repairs can be made. For instance from oneway=true to oneway=yes.

The full set of repairs is listed at:
http://www.cyclestreets.net/views/repair/

The canonized values are copied into the similarly named fields in the map_way_tags table.
The canonized field names do not include the ‘Tag’ suffix.

So for instance a way with the following tags:

highway = “residential”
oneway = “true”

becomes a row in the map_way_tags table with these original and canonized fields:

highwayTag = residential
onewayTag = true

highway = residential
oneway = yes

The howTagsUsed table lists the contents of the map_way_tags table, grouped by the canonized fields.
Hence there is one row in that table for each unique combination of the canonized values.

3. Initial impressions

The simple mapping between the OSM highway tag and CycleStreets’ provision types defined at:

http://www.cyclestreets.net/views/osmHighwayTranslation/

is used to create an initial suggestion for each row in the howTagsUsed table.

4. Rules

A set of rules is then applied to the permutations to improve the quality of the translations.

For instance a highway=”service” is intially interpreted as provision type “Service Road”.

A rule that matches bicycle=”no” converts this to “Prohibited”.

Inspecting the Translation

The /howTagsUsed/ view provides a detailed and rather complex listing of the translation.

It is possible to click on the items in that table to view the data in filtered ways.

Another way to view the information is via the map on the Journey Planner page.
When signed in with your developer account (which should also include the ‘osm’ privilege) you will have access to the ‘Ways for OSM users’ overlay. This is available via the blue plus symbol at the top right of the map.

I think we could do more to make it a lot clearer how the information has been imported and processed.

One major problem is that the import data cycle has stalled recently due to the on-going work on reducing wiggliness.
This is bad because it means the CycleStreets system is out of date, and any recently added photos will not be included on routes.

Open-sourcing

There was a long discussion about this, with a range of different views. As ‘open source people’ we are keen to Open Source the codebase, but there are a few factors which govern the timing of this, and some work to be done first.

It won’t bring in new developers straight away, but it will be an on-ramp for getting people more involved in the project.

It will improve the quality of the download and installation.

There is a danger that it could be always something we hope to do, but never actually get round to. We definitely want to avoid that.

OpenCycleMap

We were given a useful overview of how the OpenCycleMap.org project works by its creator, Andy.

This site renders cycle-specific OSM data for the whole globe. It has very beautiful rendering of hills, and in fact that accounts for 96% of the data, the remaining 4% is all the other streets, including the tiny amount that have cycling data. That rendering includes all the known, verifiable cycling routes.

The success of this project keeps their servers extremely busy, but they are soon going to expand to bigger and more powerful systems.

What we did not discuss on the developer day

Time did not permit us to get onto a whole series of other things. Here’s a short list:

  • Drag drop routing – this is a feature which already exists in Developer Mode but has not been exposed to users generally; it would need some discussion about permalink URLs.
  • The layout of the CycleStreets pages – e.g. increasing the size of the map - which is something we’ve always had a lot of feedback about. We now have a grant which could include some design work commissioning.
  • Output from CycleStreets – either as printed output or via export to GPX / KML.

Perhaps when some of the issues we’ve learned from this developer day have settled down we shall think about organising a users day to focus on some of these important, but hopefully simpler issues.

Developer Day (6th March): final details

March 3rd, 2010

Here are final details for our Developer Day this Saturday. We’ve had to amend the location as there are more people than we expected – which is great news!

If you plan to come, please let us know if you’ve not already been in touch.

Time and place

Date: Saturday 6th March 2010
Time: 10.30am for 11am start, till about 6pm.
Venue: BeginSpace (see picture)
Address: Burleigh Street, Cambridge

Here’s a journey plan from the Railway Station to BeginSpace.

BeginSpace is just outside the entrance to the Grafton Centre, one of the two main shopping centres in Cambridge. If you get lost, ask someone for directions to the Grafton Centre, as it’s quite well-known.

Plentiful and secure cycle parking is available just outside the entrance.

We’d like to thank our friends at BeginSpace, who have provided use of their incubator space for the day. Wi-fi access will be available, so please bring your laptop if you have one. We’ll be in the main upstairs room, but there sofas in the breakout area downstairs.

What we’ll cover

Things that are likely to be included, subject to time, are:

  • Overview of the CycleStreets architecture – explaining the way the system works, and what its limitations and strengths are, as well as how the code is structured. (We’ll expand heavily on the stuff that’s in this introductory FAQ.)
  • Improving the translation from OSM data to CycleStreets (and how it works).
  • The feedback system and its feeding-through to OpenStreetMap data, and people’s ideas for a better backend for this.
  • How other webapps can be built around CycleStreets (or integrated as layers and new sections in some way)
  • Plans for open-sourcing.
  • How to get other people helping with coding of the most complex part of the system: the routing engine
  • Longer-term direction of CycleStreets.
  • Mobile phone interfaces.
  • Funding!
  • Installing the code (see below) – and getting people going on a few little improvements!
  • But mostly … Whatever people want to talk about.

Getting stuck into the code: mini-projects

Depending on what people want to do, we hope towards the end of the day to get people going on some small, mini improvements to CycleStreets by way of introductory projects.

We’re working as fast as possible this week to get a small download (probably 200MB or so) available to enable a CycleStreets installation to be reproduced, which we’ll be making available and will go through on the day. (We will require people to sign a simple contributor agreement if so, as we’re not Open Source yet, but we think people will find it reasonable; we’ll try to get that online in advance.) The installation will thankfully cover only a relatively small area or two – the full dataset is huge!

We’ll get onto hacking the code later in the afternoon, so people who don’t want to do any actual coding need not worry or feel obligated to take part.

In terms of software required:

Software to set up on your laptop

Software required (please set up in advance if possible) is as follows.

The code is written in object-orientated PHP, but we hope that people familiar with other languages shouldn’t find it too difficult to understand what’s there.

  • Any OS (Windows/Mac/Linux are all known to work fine – we like to code cross-platform!)
  • Apache webserver (we use Apache 2.2.x; older should probably work)
  • PHP 5.3.x as mod_php in Apache (i.e. not a CGI installation). 5.1 and above should work, except for the journey planner engine itself, which requires 5.3-specific features.
  • PDO-MySQL (part of PHP5.3, but sometimes bundled as a separate package)
  • MySQL 5.x (older almost certainly will not work)
  • Ideally an SVN client, but we should have a zip file snapshot available too

Sustinence

We’ll pay for lunch (still to be sorted out), and we hope to offer home-cooked pizza afterwards back at Simon’s house.

We will hopefully then go to a pub if people are around for the early evening!

Funding grant from Cambridge Sustainable City

February 21st, 2010

We are delighted to announce that CycleStreets has been awarded a Cambridge Sustainable City grant, of £3,200, to cover a range of improvements.

Cambridge Sustainable City is an initiative of Cambridge City Council, who are one of a number of Local Authorities who are now linking to CycleStreets from their website transport pages. (We hope that many more will follow!)

Cambridge Sustainable City aims to involve and support the local community in Cambridge’s efforts to address environmental issues. As a means to achieving this, they offer grant funding to local groups and organisations like CycleStreets whose work brings environmental and community benefits.

We are extremely grateful to them for their support.

We will report through the coming 6 months on the improvements that this grant will have facilitated.

Future funding priorities for CycleStreets

We are continuing to apply for a range of grants. Our main funding priority is now to obtain funding for:

  • 1-1.5 full-time-equivalent Developer posts for the coming 12-18 months, to push the project forward and to facilitate volunteer help (~ £25k-80k)
  • Mobile version(s) of CycleStreets, starting with an iPhone app and a mobile view of the main site (£10-30k?)
  • Three years’ funding of a hosting cluster (£15k)

We are also strongly endeavouring to build up a developer team – see our recent blog post about our forthcoming Developer Day. But full-time developer posts are also important, though, as very complex areas like the Journey Planner core algorithms (in particular, the compression system) require weeks of concentrated and solid work, and there are a huge number of improvements and new developments we would like to make, as a result of the enormously helpful feedback we receive from all over the UK now.

If you have suggestions for funding sources, please do let us know.

Also, please consider donating £10 or so yourself – these smaller donations definitely stack up and our helpful to us. CycleStreets’ governing documents include a not-for-profit clause.

Developer Day: Saturday 6th March

February 17th, 2010

As previously posted, we’re going to have a Developer Day. The date has been set as 6th March, as that seemed to be the date that most people can do, and it gives us a little bit more time for preparation.

We’re not sure we’ve got everyone’s e-mail who plans to come, so please do drop us a line to confirm, if possible.

The venue is likely to be Simon’s house, 100 Thoday Street, Cambridge [plan journey there]. We plan to start at 11am, with eggy bread served from 10.30am for breakfast, and a pizza lunch will be provided. There is of course a nearby pub for afterwards :)

(If there are too many people (which is of course no bad thing!) we might go to CB2 or another venue we have in mind instead.)

We’ll have more info nearer the day, but we wanted to confirm the date now for diaries.

Photomap shares video

February 2nd, 2010

Short video clips can now be added to the photomap.

Here’s an example of Simon getting his feet wet on the flooded section of the public bridleway next to the Cambridgeshire busway.

Videos can be up to 50 MB in size, and may include sound. Formats currently supported are MOV, AVI, WMV and FLV.

They are converted to a low resolution flash format, and a still from the first frame of the video is used for the image in the photomap.

http://www.cyclestreets.net/photomap/add/video.html

Developer Day – sign up now!

January 29th, 2010

We’ve now firmed up plans for our Developer Day, to be held in the coming month.

We’ve had various kind expressions of interest from people wanting to get involved at a more technical level, either in terms of programming or the OpenStreetMap-related aspects, and we thought this would be a good way of helping that process along.

If you wish to come, please add your name to the birdcage of possible dates. If we’re not likely to recognise your name, please drop us an e-mail so that we know who to contact!

The possible dates are:

  • Friday 19th February
  • Saturday 20th February
  • Friday 26th February
  • Friday 5th March
  • Saturday 6th March

and it will be held in Cambridge (location to be confirmed).

The sorts of things we expect to cover are:

  • Overview of the CycleStreets architecture – explaining the way the system works, and what its limitations and strengths are, as well as how the code is structured. (We’ll expand heavily on the stuff that’s in this introductory FAQ.)
  • Improving the translation from OSM data to CycleStreets (and how it works).
  • The feedback system and its feeding-through to OpenStreetMap data.
  • How other webapps can be built around CycleStreets (or integrated as layers and new sections in some way)
  • Plans for open-sourcing.
  • How to get other people helping with coding of the most complex part of the system: the routing engine
  • Longer-term direction of CycleStreets.
  • Mobile phone interface(s).
  • Funding!
  • But mostly … Whatever people want to talk about.

CycleStreets Developer Day coming soon

January 21st, 2010

Eureka moment: the bacterial (amoeba) algorithm

We’re planning to hold a Developer Day soon.

We’ve had various kind expressions of interest from people wanting to get involved at a more technical level, either in terms of programming or the OpenStreetMap-related aspects, and we thought this would be a good way of helping that process along.

It will be held in Cambridge and probably on a Friday or Saturday in March/April, if not sooner.

The sorts of things we hope to cover are:

  • Overview of the CycleStreets architecture – explaining the way the system works, and what its limitations and strengths are. (We’ll expand heavily on the stuff that’s in this introductory FAQ.)
  • Improving the translation from OSM data to CycleStreets (and how it works).
  • The feedback system and its feeding-through to OpenStreetMap data.
  • Plans for open-sourcing.
  • Mobile phone interface(s).
  • Getting more funding!
  • Whatever people want to talk about.

If you’re interested, do drop us a line. I’m sure there’ll be plenty of pizza!

Pizza!

View from the Street – in itinerary listings

January 17th, 2010

We’ve now added a Street View facility to the itinerary listing pages. We think this will really help people to visualise the routes planned in many urban areas.

Many thanks to George Coulouris, who wrote the main code to integrate this facility into CycleStreets.

To use it, just go to an itinerary listing, e.g. Itinerary 100,000 and click on the ‘Street View’ icon   next to any segment of the route, and the Street View panel should open just below that point.

Please do use the feedback button to provide a bug report if it doesn’t work in your browser. It seems to be OK on FF3/IE8/Chrome but more testing is welcome.

The system uses Google Street View, which is limited to some urban areas only, although Google are gradually covering more areas .

100,000 cycle journeys planned on CycleStreets

January 16th, 2010

We’re pleased to announce that the CycleStreets Cycle Journey Planner today reached a milestone of 100,000 journeys planned.

(Well, actually it was 99,999 – we added the next one to reserve the number!)

How long till 1 million? … :)

Overview of CycleStreets: your questions answered

January 4th, 2010

We’ve created some long-needed documentation: Overview of CycleStreets: your questions answered, covering a number of areas:

Many of these are things which we’re often asked about, particularly from people within the technical community.