Categories
Bike Share London OpenLayers OpenStreetMap Technical

All the Docks: Technical Notes on the Routes and Map

Routes

I created GPX route files for the challenge. These were created manually in QGIS, using the OpenStreetMap standard “Mapnik” render as a background, by drawing lines, with Google Street View imagery used to check restrictions.

I split each team’s route into 12 stages (so 36 altogether), which were initially each just over 10km and ended at a docking station. Each stage contained between 10 and 40 sequential legs to docking stations. I’m not sure I would trust proper routing engines (based on Google Maps or OpenStreetMap, normally) to have found better routes on each leg between each docking station, than me and Google Street View, largely because many London boroughs have been experimenting a lot recently with Low Traffic Neighbourhoods (LTNs) and modal filters (e.g. two way for bikes/one way for cars). But I did run a TSP solver (RouteXL) on 3 of the stages and in 2 cases it did find a slightly shorter ordering of the legs, within the stage. So I would probably use a TSP solver more for a future iteration of the challenge.

The three route/team files were saved in British National Grid (EPSG27700) GeoJSONs (technically not allowed by the spec) so I could get proper metre distances ($length) auto-updated into a column, for each stage, during planning. The stages had a number column, and were numbered sequentially. Having a number column results in LineStrings in the GeoJSONs and GPX routes/routepoints rather than single MultiLineStrings and GPX tracks/trackpoints. They were then saved as WGS84 GPX files. I (mis-)used a very limited set of column names (name, number, src, desc, cmt), due to the restrictions with the GPX specification – I didn’t want to use GPX extensions.

It was important to have three separate GPX files so that each team would need to load in just a single file to their navigation device and not see docking stations/routes from other teams). But it did make preparations a bit harder for the online map.

The docking stations were imported in via a TSV file, then saved as GPX waypoints (column names again restricted to src, desc, name, and cmt), and the relevant ones were manually appended to the GPX team files. The GeoJSONs were retained as my master editing files, as QGIS cannot easily edit GPX files due to them containing multiple geometry types.

I would certainly like to try a more automated approach to the routing. It did take a substantial amount of time – probably two evenings for each of the three routes, and a further evening for each route to enumerate the docking stations, fine-tune the routes and reorder any sliced up GeoJSON LineString segments (part-stages) back into the correct sequence. The reordering was needed as QGIS would incorrectly reorder parts of the route that crossed over itself, when it was sliced up.

But an automated approach would require a method that deals with docking stations that are just 10m down a no-entry street (so you’d just walk it), which is hard. Currently they are represented as a point defined by TfL through their API (and separately in OpenStreetMap) which may be the location of the “totem pole” kiosk but not the docking points themselves. In routing or GIS systems, the docking station needs to be represented as an area (within which you would walk the bikes) plus a (multi-)line (representing the line of dock points – some of these are quite long – some have significant gaps, and sometimes they are split on either side of a road). Potentially, the point representing a docking station really needs to be an area, and that area can extend up to the nearby road junction to deal with the one-way issue.

Future Improvements

In terms of the general design, a few things could be changed for a future challenge (some of these I mentioned in my previous blog post):

  • Ensuring that participants are well away from the finish at around the 60-80% stage, so that they are less likely to bail at that difficult time of the day, because the remainder of the challenge is then a kind of “run in” to the finish, rather than routing them away at a late stage.
  • When participants pass by another docking station twice, they should visit it on the first occasion, not the second time. (An exception is when it is on the wrong side of a dual carriageway, particularly one with a median barrier). Otherwise there is a danger of it being missed on the return.
  • Build specific meal stops in.
  • Maximum of 200 docking stations/10 hours per team.

The Web Map

By comparison, building the web map was straightforward, probably just one evening’s work to build the map page itself as a basic OpenLayers map reading in GPX files and with simple browser-based geolocation, and one further evening to build a “team” version of the map that allowed ticking off the stations, the action being stored in a database, and a time string echoed back to the web map (and other viewers, on a Javascript timer) as confirmation. The database had two tables, a summary table with a row per docking station, and an action log which recorded the dock’s TfL ID, timestamp, event type and the submitter’s browser user agent string ($_SERVER[‘HTTP_USER_AGENT’]) in lieu of logins/IDs. It was fairly easy to assign a manually assign each user agent to team, post-event.

Each docking station ended up with 4 identifiers which feels a bit too many, but it kind of made sense:

  • an integer TfL ID (e.g. 761)
  • the TfL Name that appears on the totem pole (e.g. Gower Place, Bloomsbury)
  • a shortcode which was the sequence number and the initials of the first part of the TfL Name (e.g. 37.GP). There were some duplicates across the team. FIN.HS was a special shortcode for the finish for the two teams that didn’t have that as a docking station in their “zone”. One newly added docking station had “A” appended to the sequence number of the previous, rather than having to renumber everything.
  • a unique sequence code which was the team, stage and docking station order within that stage, (e.g. W02.15). This was used as a logical ordering of the file and to help with assigning each docking station to its stage on the online map.

I also listed an “actual sequence” post-event ordering, e.g. W038, in the final results file.

I could have used the sequence code on the map but felt the shortcode was the most useful concise way of identifying each station to the team as they approached it, and hopefully the simple number would result in any missing out being spotted quickly.

I built a special “diff” webpage that compares our docks file with the live data (via BikeShareMap) every 2 minutes and this alerted us of any new, closed or zero-capacity docking stations, plus a list of full ones. There was one that opened a few days before, but none on the day, thankfully!

Future Improvements

I do think that using fewer intermediate routing points on each leg would be better and would allow for turn-by-turn satnav directions. Having said that, having street names called out is of limited use as they are often hard to spot on the ground, so the breadcrumb trail approach we used worked well.

We had paper maps (just screenshots of the website) as a backup. I never used them, and I think Team South used the website. Team West used them exclusively, with a separate person using the website to tick off.

I would have liked to have had a single source of docking station locations. In the end, they were:

  1. on TfL’s API, which is fed through to a CSV on BikeShareMap every two minutes,
  2. on a CSV file on Github,
  3. as GPX waypoints appended to each team’s GPX routes file, and
  4. in my database for recording times on the ATDMap website.

1 and 2 were automatically compared (see above), 2 could be added to QGIS to compare and generate GPX for 3, and also imported into the database table (4) but this would all be manual steps.

Links

Website map with the timings: https://misc.oomap.co.uk/atdmap/

Route GPX files and timings CSV: https://github.com/oobrien/allthedocks

Strava link (Team East): https://www.strava.com/activities/7908548122

Categories
Bike Share London

All the Docks: How it Went

On Monday I spent a lot of time (over 13 hours) cycling between 268 docking stations in London. It was for the All the Docks challenge, as part of Team East, with Joe (Be.EV CCO, and ex-ofo) and Jeyda (fettle CEO). There was also an all-stars Team West and Team South (including Voi, TIER, Zwings, and CoMoUK people – see this blog post for the announcement), and, across the three teams, we aimed to visit all the docking stations in London in a day.

Black = done. Green = not done. From the web map.

Team East: By the numbers

  • Three challengers: two on Santander Cycles (one docking at every point) and one on their own bike with navigation mount.
  • Started at 08:51, after getting breakfast nearby.
  • Two stops for food (at 13:30 and 20:15) plus a shorter stop to buy snacks (at 16:30).
  • Three lifts (which weren’t big enough for three bikes!)
  • Finished at 22:21 – 13.5 hours later
  • GPS says 119km although it added a lot 0f noise around Canary Wharf and a few other places, so I think the actual distance was more like ~113km.
  • 268 docks visited (the 266 assigned to Team East, plus the common finish docking station, plus a short bonus leg to the docking station outside the finish pub).
  • This works out as visiting a docking station, on average, almost exactly every 3 minutes, for 13.5 hours.
Team East’s actual route, on Strava.

What went wrong

  • It did take a bit longer than predicted. The target time had been 12 hours (11.5 hours + 30 minutes in breaks) and our average moving speed of 11.9kph was quite close to the 12.5kph in a prediction algorithm I put together. The two hour difference was due to food stops and comfort breaks (75 minutes in total), along with that 0.6kph speed difference (30 minutes extra) and the three legs we I had to jog (15 minutes). Our dock/undock speed got pretty good after Joe (who did 80% of the docks/undocks) got into a rhythm.
  • My personal bike (which I had planned to ride as a support to the team leader on the bikeshare bike, to do the navigation) had a flat tyre right at the start, which meant I had to hop on a Santander Cycles bike for the entire route. I had a big freak-out when I discovered this (no bike shops in Westfield Stratford City, challenge starting in half an hour) but it was OK in the end – I bought a £20 monthly membership in the app, on the spot, and the ride was more comfortable than I expected, but it did mean I needed to keep fishing my phone in and out of pockets at every docking station.
  • I also twice forgot to dock at least once an hour, twice, so got two £1.65 overage charges).
  • A result of my phone (with map) not being mounted on my bike, was I was constantly pocket-tapping the team version of the map as I kept grabbing my phone. This mean I kept ticking off other teams’ docking stations by mistake, particularly Team West’s list. The team version needed a UX tweak so the checkboxes’ labels were not tickable, or have separate tick-pages for each team.
  • The only significant routing error was at Import Dock in Canary Wharf (no regular Google Street View allowed there, so I couldn’t see in advance) where we ended up at road level, but the docking station was below us, at water level. Taking the bikes down an escalator in the new Crossrail/Elizabeth line station, got us to where we wanted to be.
  • Proper food stops need to be built in to the schedule, rather than hoping we accrue time and then spend it when we need it. We got hungry in places were there weren’t any quick eateries.
  • Three legs had to be jogged by some rather than cycled by all, due to infrastructure problems, although we still docked or undocked at each. At the first one, both Joe’s keys stopped operating and the dock was full so I couldn’t dock (with my third account) either. So I cycled to the next docking station, docked, ran back and undocked. A later problem dock wouldn’t release any bikes so I handed mine over and jogged to the next station to get another one. Finally, three from the end, the terminal disconnected after docking successfully, so I ran back to the previous one and went from there to the penultimate one.
  • One or both of our pair of keys got temporarily blocked several times. With one blocked, using the other, single key resulted in a mandatory 30-second delay before you are allowed to start another journey. Each time, a call to Santander Cycles support fixed the blocked key quickly. Santander Cycles does have a responsive and effective telephone support operation.
  • One docking station appeared to have been vandalised, with the “slot” on most docks crushed so that the bike couldn’t be docked. Eventually we managed to find one where we could squeeze it in.
  • Routing people near the finish, then up a hill and away, 10 hours in to the challenge, is demotivating, and coupled with the late time, I think this is what made Team West’s decision for them. A long, clear run into the finish line without big loops away, is preferable! In general, my design for West and East was a long wiggly route up and down, towards the finish, from the outermost parts of the network. By contrast, Team South went near the finish quite early on, before a long tour out to Putney, finally coming back along the river, back into town. I think this latter overall shape of the route probably is better for keeping people going to the end.
  • A few of awkward wrong-side-of-road docking stations on dual carriageways had to be visited, although generally with traffic lights, we got across OK. The worst link was a short section of The Highway followed by a right turn. This is a horrible road, and the others in Team East took the pavement instead (but were further encumbered by barriers left up from the London Marathon the day before). In retrospect, a walk-bikes route back across a new private development’s plaza would have been better.
  • A few roadworks made getting to some docking stations tricky. In the end, Team East had four blocked links – resurfacing by the Orbit sculpture in the Queen Elizabeth Olympic Park (where we just cycled through the construction site), park re-modelling in Shoreditch Park (which necessitated using park paths to get around it), Angel Street was closed for building construction (so we went through Postman’s Park instead) and finally St Bride’s Street was completely blocked for resurfacing, but the Poppin’s Court tiny alley diversion was a lot of fun.
  • The low point was at around 7pm, as the sun set, calculations suggested all three teams were well behind a nominal 9pm finish, and it looked like we would have to bail to make it to the pub. There was also some concern about what it would be like doing this kind of frantic point-to-point riding at night in London traffic, with tired legs, although in the end the traffic levels died down quickly after rush-hour. We also hadn’t had dinner and a proposed food stop at Angel was still 90 minutes away. A conference call between teams was held and a final decision at 9pm would be taken.
  • We approached the Somers Town Bridge at around its historic 9pm closing time (not sure if it actually does still close) so decided to take a long diversion around.
  • In the end, just after 9pm, we passed by our team lead’s home (25 from the end) and, with one eye on a very early start the following day, he opted to stop there. Team West had already quit and were arriving at the pub. Team South decided to double down and keep going. Their final stage along the spectacular Embankment at night, with views across the Thames, may have helped with their decision! We carried on for a final section around King’s Cross and, in the end, quite quickly down to the finish at LSE.

What went well

  • By and large my manual routes worked pretty well. For Team East, there were only a couple of banned turns and one wrong-way street encountered, easily fixable on-the-fly. The teams were pretty happy with my routes, which is good!
  • Careful planning tried to minimise the number of docking stations on the other side of busy roads, even if this slightly lengthened the route.
  • I was pleased I could include some of London’s best cycle infrastructure without lengthening the routes. The Olympic Park, Victoria Park, Regent’s Park, Hyde Park, Kensington Gardens, Lower Thames Street and Victoria Embankment (CS3). It was nice, on the day, to unexpectedly discover some of London’s newer protected cycling infrastructure on roads I knew well from pre-protected days.
  • After a while, we honed our docking/undocking technique and Joe got it down to around 15 seconds. Every 10 seconds saved per dock is 45 minutes saved on the challenge as a whole.
  • Considering the amount of docking/undocking operations we did, we had very few failed locks/unlocks or disconnected terminals.
  • My gadget batteries worked out OK. My old Garmin GPS wristwatch lasted 9.5 hours (albeit with no HR or Bluetooth), and then the last bit of route recording was done directly on my phone using Strava in the background. I only used GPS on my phone sparingly, to occasionally locate myself on the web page, but after 11.5 hours my phone’s battery had got down from 95% to 3% so I kept it plugged into a power bank on a cable, for the remainder, and it was fine. Jeyda’s Wahoo’s battery was absolutely fine throughout.
  • We did visit all 268 docking stations, even if it took us nearly two hours longer than planned.
  • We all stayed in good spirits as a team, and generally stuck together, although we did split up a bit near the end as different people drove forward to keep the pace going.
  • I thought we might need an operations person at a desk, checking for changes, handling social media and directing/motivating teams, but actually it worked fine with everyone on a bike.
  • We crossed the finish feeling fine – it’s the day after that I felt shattered.

Notes for a next time

  • General consensus in the pub was that having four teams (N, E, S, W) doing around 200 docking stations each, would be more fun and would allow more pub time, food time etc. Team West ended their challenge after around 200 docking stations when it was clear they would struggle to get to the pub before closing time if they continued (and as they had to loop away from near finish at that point). Team South made it just after last orders so Team West bought a round for them in advance. But a decent length social after such an exhausting day is important.
  • Finishing at the docking station outside the pub would have been better (I had decided against it because the distances across the three teams wouldn’t have matched as well).
  • Hopping on and off the bike for each dock gets tiring. Particularly as so many of the docking stations are on pavements and facing away from the road, resulting in many kerb hops, jolts and awkward manoeuvres. Possibly alternating the docking between two leads would make this better?
  • You definitely need one person to have a bike-mounted smartphone or navigation device (Jeyda’s Wahoo device worked pretty well) to do efficient navigation on a mounted stand rather than in/out of pocket.
  • Having two keys (on two accounts) is essential. As well as cutting down the dock/undock time, it can deal with full docking stations.
  • Santander Cycles finally launched electric bikes into their fleet, a few days after our challenge. These would be good for support riders, if too expensive for the lead rider (£1 surcharge per leg!)
  • I/we would definitely invite people to accompany us for a stage or a few legs. We did have Ilma from Fettle along for the City of London legs which was motivating (and she filmed a mini-movie/montage of us)
  • I’m glad we missed the morning rush-hour and the evening rush-hour while we were in the City was pretty intense too.
  • Some routing tweaks would be good. See a future blog post here for some technical details on how it was routed and how it could be made better.
  • Finally, I think the mapping/recording could be automated more. I liked my live-updating map, it was the result of a few evening’s simple Javascript coding, but there’s definitely more that I could do – leaderboards, current location pin, ETAs etc.

One note on helmets – normally I would always wear a helmet on my own bike, but not on bikeshare bikes – we shouldn’t be encouraging it for bikeshare bikes as it significantly reduces their utility and appeal for spontaneous journeys. However – I’m glad I did wear one, because we were on the bikes for 12+ hours, occasionally taking some quite aggressive manoeuvres to get across to the other sides of streets. We had no incidents or even any beeps from drivers, but one person in one of the other teams got bumped by a van. You do feel pretty secure on a Santander Cycle even without a helmet, as they are 25kg, feel incredibly sturdy, and you can never go that fast on them. But for this kind of challenge, hazards were definitely higher than normal and so the extra security of a helmet was welcome.

The Pashley-made bikes (bike numbers starting with 5) make up around 20-30% of the fleet and are definitely better than the older bikes still available, as they are newer. They are slightly lighter, have better lights, a more solid seat adjustment mechanism, and generally just feel nicer. We generally opted for those bikes, and typically stayed on the same bike for hours at a time.

I’ll have one more blog post about the challenge soon, some technical notes about how I put together the routes and some of the issues I faced doing so.

Links

Website map with the timings: https://misc.oomap.co.uk/atdmap/

Route GPX files and timings CSV: https://github.com/oobrien/allthedocks

Some photos courtesy of Jeyda and Joe. Background mapping © OpenStreetMap contributors.

Some tricky legs in bow. East India Dock (38.EID here) is in a particularly tricky location.