Active Travel Hackday writeup

It's been a long time since I went to a hackathon. I remember enjoying the first few I went to (my personal blog shows me going to Rewired State first in 2009 and then again in 2010 for Rewired State: Carbon), but overtime that turned into frustration as I realised that there was rarely any follow through. A lot of people poured out a lot of energy and then there was no consequence. Combine that with the fact that corporations seemed to realise they could use these as a way to hook people on their latest API as they slowly enclosed the open internet, I flipped to being quite against hackdays. Thankfully, at least in my secluded corner of the Internet, they then felt out of fashion, and were never heard of again.

However, they say that time heals all wounds, or at least numbs the pain of memory (though I still refuse to ever go back to T in the Park), and so I was intrigued when I saw Adrian McEwan announce he was running one over at DoES Liverpool. The combination of organiser, who has a strong commitment to trying to solve local problems and being focused more on people than tech, and venue (a maker space with a strong sense of ties to the local community) gave me some confidence that this one might actually be interesting. And so on Saturday I headed over to spend the day at an Active Travel Hackday.

What is an active travel hackday?

For those, like me, that haven't stumbled across the term active travel, it is defined by Transport Scotland as:

Active travel is walking, wheeling or cycling for a purposeful journey. Wheeling includes using a wheelchair or mobility aid as an alternative to walking.

So, getting around on your own, and that is as detailed as the theme was. There is a healthy intersection of people at DoES and the Friday night late cycle group, so cycling was perhaps inevitable that it'd come out as a strong theme for the day, but there was also some discussion around mapping out drop kerbs for wheelchair mobility too.

There were about a dozen or so people that turned up for the event, and the make up of the participants was the next sign that this wasn't going to be like the hackdays of old, as I think I'd describe about 1/3rd of the attendees as professional techies, 1/3rd as cycling enthusiasts first that do some Python in their spare time, and 1/3rd just people who partake in active travel or wish they could do more around Liverpool but had some issue they needed solving (to be clear, that also covers some of the former groups too). This solved one of the main problems with hackdays (and the tech scene in general back then also) of having solutions in search of problems. It was quite refreshing to see the problems and challenges of the local area come first and be represented in the room.

By having a small number of people attend (compared to say Rewired State events which had over a hundred people), we actually were able to spend the first hour discussing what it was we each wanted to do, and then coalesce around some common themes into groups. This in itself was also quite a different vibe to hackdays of yore, where there was much more pushing forward on ones own idea. I had come with something I wanted to work on (improving topogmesh to add road support), but Adrian's gentle nudging to form groups called to mind one of the session openers at The Festival of Commoning, I think by Sue Bell, who recounted an anecdote of the difference between US company brainstorming sessions and Japanese company equivalents: in the US people would all push for their idea over others, where as in Japan when people came to talk they'd take the early ideas and build on them. I've no idea how true this story is, but it made me put aside my own idea for the day and opt to add myself to one of the other groups' efforts.

In the end a few common subject themes emerged:

Unsafe cycling routes: a couple of people raised concerns around cycle safety in the city, be that not wanting to cycle on unlike routes at night, or having had problems with being harassed. Just having a marked cycle route doesn't inherently mean it is safe for cyclists, particularly if it's away from other traffic at night.

City cycle route planning: Liverpool has plans to add more cycle routes through the city, but are the routes actually the right ones? They seem to follow potentially busy roads where dedicated cycle lanes might not fit, for instance. Can the community be involved in trying to plan them and suggest alternative routes?

Active travel for city benefit: One person had found some papers on the economic benefits of having a populous that is more fit, and wanted to try find a way to present that to expand the narrative of active travel just being of benefit to the individual.

These are all very cycling biassed, which reflects the people who had turned up to the event and the local bias.

The one technological theme that emerged was the use of Open Street Map (OSM). I guess this resonated because as a technology platform it's something that all comers to the hackday could work with: you can see what is already there as a form of research, you can do edits to add or clean up data, you can use tools like umap to make custom visualisations of the data without code, and then if you are a coder you can do even more bespoke data-mining and presentation.

What I worked on

My experience of the hackday was one of mostly being frustrated as I learned my way around OSM data and how to process it, and make edits. None of this section is that interesting, particularly so if you already have worked with OSM, but it's here so I have notes for the next time I do this. If you want some summary thoughts on the event itself I suggest you skip on to the next section.

I joined a group with two others and we looked into the topic of lighting and cycling routes, along with some other safety aspects like road speeds and other data we could find that might relate. We knew that OSM knows where cycle routes are, as you can get a cycle map view, and one of our group (Mark, who originally suggested the topic) had done some digging before hand to know that there was lighting information in there too. Oddly the OSM cycle view doesn't show cycle parking, but there is data in OSM where people have contributed it for cycle parking, but for that you need to use a custom map on another site 🤦

Exploring OSM data

Before the hackday I'd never really looked into how OSM stores the data. Most normal people probably think of OSM (if they think of it at all) as a map, but in fact it is a giant data store from which maps can be made. If you're so minded (unlike with say Google or Apple maps) you can actually access to the raw OSM data using their query tool, Overpass Turbo. It's not the most user-friendly of tools, but here you can write queries in a custom query language to let you try surface the items you want (similar to how Wikipedia has the Wikidata query portal).

I did also try using QGIS for looking around OSM data, as I've seen people make nice maps using QGIS and thought perhaps I could use to make some visualisations (I had grand aims before I got totally lost in the weeds). For those not familiar with it, QGIS is a popular open source desktop application for working with geospatial data; it's a pain to learn to use as it does so many things, but I've had to get used to it for work, so I figured I might as well try use a tool I'm familiar with. There is a plugin for QGIS called QuickOSM that lets you query OSM data, and whilst you can build up queries using a series of drop down filter, there is also a tab where you can paste in an Overpass query as you would on the Overpass Turbo website.

One gotchya to this was I'm running the beta builds of QGIS on my mac: despite Apple's migration to their Apple Silicon CPUs starting five years ago, there are still no Apple Silicon native builds of QGIS, due to its dependancy on an older version of the QT GUI toolkit. Thus I've been running beta builds of QGIS 4, due out later this year, as that does have Apple Silicon builds; however QuickOSM does not work with the beta version, and so I had to download and install a regular QGIS build and use that via rosetta. 🤦

Having worked out the how to query OSM, what I then discovered was that the OSM data is somewhat a) messy and 2) of limited in expressivity. This is true of any attempt to construct an ontology to store in a computer the mess of the real world, and shouldn't have come as a surprise to me, but certainly was more work than I anticipated when we set out trying to answer our question.

I come across this kind of issue regularly in my day job, where we use the IUCN Redlist, a database of information on endangered species, where every species has been classified by a series of terms, and we often hit issues where species are include or excluded in experiments when they should or shouldn't be because the database just doesn't have the expressivity to say this particular bird mostly lives over land but occasionally goes over the ocean and so is marked as marine but actually you could take that water away and it'd not mind. Real world classification is always going to be limited, and OSM can not be exempt from that.

I think OSM also struggles because in the real world there are so many ways we designate a cycle way: road with a cycle lane, dedicated bike path, a road that is part of the national cycle network, and so forth. After a bunch of prodding I had this query that got me enough of a result I could worry about the lit vs un-lit question, but it isn't even attempting to be completist. For example, it doesn't include bridleways; although bridleways are intended for horses are legal in the UK for cyclists to use, not something I knew until Adrian mentioned it to me afterwards (highlighting once again the importance of including active practitioners (cyclists in this case) in any technology endeavour).

[out:json][timeout:25];

relation["type"="route"]["route"="bicycle"]({{bbox}})->.cycleRoutes;
way(r.cycleRoutes)({{bbox}})->.routeMembers;

(
way["highway"="cycleway"]({{bbox}});
way["highway"="path"]["bicycle"="designated"]({{bbox}});
way["highway"="path"]["bicycle"="yes"]({{bbox}});
way["highway"="pedestrian"]["bicycle"="designated"]({{bbox}});
way["highway"~"footway|track|service"]["bicycle"="designated"]({{bbox}});
way["cycleway"]({{bbox}});
way["highway"="bicycle_road"]({{bbox}});
way["cycle_network"]({{bbox}});
way["ncn_ref"]({{bbox}});
way["rcn_ref"]({{bbox}});
way["lcn_ref"]({{bbox}});
way.routeMembers({{bbox}});
);
out body;
>;
out skel qt;

So we have our cycleways, then the question is which ones have lighting at night. There is a lit tag, which I filtered on yes/no to try and work out which cycleways might be more acceptable once the sun goes down. But even this query is ontologically naive I realised later. Not only does the lit tag have values other than yes or no, there are other tags like lit_by_led and lit_by_gaslight according to the OSM wiki. And that "according to the OSM wiki" is doing a lot of work there, as I also discovered that if I look in the OSM editor that there are yet more values for the lit tag than those documented 🤦

As I say, I have sympathy here, but I suspect as a grass roots project this problem is more of an issue for OSM than the aforementioned IUCN Red List where at least the IUCN will take on the role of controlling the accepted representation of values and defining them in standards (e.g., this one for habitat classification). Those classifications are something that are frustratingly restrictive at times (we have dry and moist forests and desert, but not for arable or pasture?), but poking around OSM made me appreciate a bit that there is a benefit to having a controlling organisation here.

The O in OSM

Because of my own lack of familiarity with both OSM tooling and the data structure (or lack thereof), I quickly hit another problem: I got blocked by the OSM API server for making too many queries. Thankfully though, the "open" in "open street map" isn't a meaningless word, and I can actually download OSM data and query it locally. Now, all of OSM is a lot of data, but you can download sections of OSM data. I started trying to download all of the UK data, but in the end that was taking a while and looked like it might exceed the free space I had on my laptop. But thankfully you can just download the UK by subregion, so I just snagged all the data for Merseyside. Once you have the data, you need to have some way of working with it. QuickOSM in QGIS can work with the OSM data file that you download, however you lose the ability to use the Overpass query language and have to go back manually selecting keys and values in drop downs in the UI at this point, and my query was 70 lines long, so I decided this wasn't the way for me. Thankfully I've some experience in using the Postgres database and the PostGIS extension to that, as that seems to be one of the preferred options, using osm2pgsql to load the data into the database. Once you've done this, you can connect QGIS to a PostGIS/Postgres database, but I didn't fancy editing my queries in the QGIS interface, so I ended up writing my SQL queries as a custom view in Postgres that I just displayed in QGIS.

The tl;dr here is that whatever I was doing wasn't the best way of doing things. Due to my job aligning with this, it was easy enough for me to end up with a custom database/QGIS solution, but for others just interested in playing with OSM this isn't ideal.

A question of modern hackdays

Before I get onto what did I learn from all the above messing around, I wanted to address this question from Derek McAuley (aka Mac):

I would be interesting in hearing attendees attitude to / use of AI coding shite - and is it banned / tolerated / encouraged by organisers?

Mac asked this as I was headed over to the event, and I think with the framing of what hackdays I've been to in the past, this would have been an interesting question. At those events there was a rush to push out an app or a website to solve a problem and win the crown for the day. Under that configuration I think even false solutions would have been made than there was back then. However, given the tone of this hackday, there were zero apps or website generated by the end of the day.

Still, there was no guidance given on the topic, and it certainly wasn't encouraged: the culture at DoES Liverpool is heavily open source leaning and community over tech focussed, so my instinct is that this is less of an AI crowd. Of the dozen or so people there I was only aware of three people using any "AI" style tools, and (sorry Mac) one of those was me. I used Claude to find me OSM tags that might be of use and to convert my Overpass query to something for Postgres given I didn't know the database schema osm2pgsql generated. I believe the other two people used ChatGPT for a similar level of usage - a stack overflow or better search tool.

Not sure what that shows, but I guess if the fear is that AI tools were enabling a lot of useless software being generated to solve problems, that wasn't the case.

One somewhat related topic I think is why we didn't generate any web-apps.

One of the ideas that floated earlier in the day around safety and security of people on cycle routes was a sort of "trip advisor" for cycle routes, allowing people to rate how secure they felt the various routes were. I think in an earlier generation someone would have built this in rails or django and had it running on a domain by the end of the day. But I think the lay of the land for running these services is now every different: moderation requirements mandated by things like the online safety act raise the requirements around setting up a quick service like this. Even in lieu of the OSA, I think in general we know that community websites need community moderation, it's been interesting watching the fediverse deal with this (or fail to deal with it some cases). So for me it was an interesting tonal shift to realise that the sort of thing we made without a second thought (we probably should have had second thoughts for other reasons) is now actually something that requires more careful consideration.

I think anything we generated on that day as a demo would certainly not be of interest to anyone looking to enforce the OSA, but I think having that hang over such projects as something that would need to be done had a somewhat slowing down effect on that direction of thought: if this was successful would I be the one who'd want to deal with all that? Is this solution sufficiently amazing that it'd be worth all that?

A wrap up

In the end the hackday felt like the prep-day for another hackday to come. In the end we had four groups work on topics, and I think we all ended up learning a bunch about what data was out there and what barriers there are to using it to solve any of the identified challenges.

For instance, for the playing around our group did with OSM data to work out what routes are lit or not, the main learning was that OSM mostly doesn't have enough information. In the screenshots I posted above, green lines are lit routes, red lines are unlit routes, and blue lines are just no information. Even allowing for my lack of understanding of how many variations on lit there are in OSM's data, the fact is most of the routes in Liverpool and The Wirral don't have this information set. By far the biggest output of the hackday from that point of view was that on the day after I learned how to edit OSM and went and tagged the cycle paths around the West Kirby area we stay in up there to make sure they're correctly annotated (the first screenshot is after I did this, the second one before).

I think the main outcome is that for all the data there is in OSM, there's still a lot missing. This relates to conversations I've had with Anil back in Cambridge, where perhaps there's a need for an OSM "fill in the blanks" app - a way to highlight what is missing from OSM in the area you're in: in a lot of places you don't need the "is there a road here or not" level edits, but "is there a pedestrian crossing?", "is there a drop-kerb for wheelchair use?", "is this route lit at night?", etc. Could we make it easier to fill the less exciting data into OSM that is actually going to make it much more usable to different communities?

On the topic of safety though one of our group did find the Cycle Travel website which does actually have a toggle for night which keeps its routes on main roads rather than using say the Wirral Way. We're not sure how they're doing that, but it was at least something that we could recommend others use.

The group looking at the community commentary on proposed cycle routes got as far as finding the data, liberating it from a council webpage, and converting it to some more standard format they could then start to present as a layer on top of existing maps. Nothing concrete, but a good bit of sleuthing that makes the next stage possible. Another group used tools to mash up data from the police about bike thefts and relate that to cycle routes, a good start, but not the solution yet.

To that end, there remains one task from the hackday for me: I need to put forward some dates for a follow on. There was a general consensus in the room that we'd just got started on this topic, but we'd all like another day to get together and see what we can do with that learning. And I guess then that solves the problem I had with all those original hackdays that there was never any follow on - I just now need to be the one to organise it.