Bridleway finder
Skills used:
- Angular
- RxJS
- ngrx/store
- NestJS
- Postgres/PostGIS
- Docker
- MapLibre GL
- Turf.js
- tippecanoe
- Osmium
- TypeScript
- Node.js
- NGINX
- Git
- nx
- Monorepos
Overview
A personal project spurred my interest in horse riding, I was frustrated at how difficult it was to find bridleways and other suitable routes for hacking out. I took it upon myself to build a website that combined public right of way data from local authorities with open data from OpenStreetMap to create a searchable map of bridleways and other routes suitable for horse riding.
The challenges of PRoW data
Upon beginning this project I had the intention of exclusively using public rights of way data from OpenStreetMap, however with this being crowd sourced data, ensuring my filters were extracting and specifying the correct designation was at the mercy of the crowd sourced data being correct. I therefore decided to use public rights of way data from local authorities as the primary source of truth, and thankfully Barry Cornelius has collated all available public authority data on his website.
The GeoJSON data provided by some local authorities present some challenges when processing the data for ingest into the map tiling service and database. Many authorities will give multiple ways the same IDs even if there is no continuation between the individual ways. Some ways would be split into multiple sections of a relation, however each of these sections may not be in the correct order, and the order of the points would vary from section to section. This made if extremely difficult to filter duplicated ways that are also found in the OpenStreetMap data.
To overcome these challenges I wrote a programme that would take prefrome geospatial analysis on both data sets. This program:
- Converts OSM formated data to GeoJSON
- Filters only PRoW data from the OSM GeoJSON
- Finds OSM ways that overlap with local authority PRoW ways
- Merges OSM data such as surface, trail visibility, and riding difficulty on to matching PRoW ways
- Combines PRoW features into one long feature if possible
- Generates map tiles for the website to use
With millions of ways to process from both public authorities and OpenStreetMap, the program needed some significant optimisation to ensure it completed within a sensible time. Utilising techniques such as splitting the UK into a geospatial matrix, and utilising parallel processing, I was able to optimise the run time from multiple days to just a few hours.
Building the map
The user facing side of the project was arguably the easiest part to build. The UI is built using Angular, RxJS, and ngrx/store, and mapping provided by MapLibre GL (an open source fork of Mapbox GL). The backend is built using NestJS, nodemailer, Postgres/PostGIS, and nginx. Deployments are made easy by containerising the application using Docker.
The website features the ability to toggle map layers by PRoW type, find related ways that continue from the one you are currently viewing, and user comments so riders can communicate the suitability or issues they may have encountered riding on that way.
User management
Having the ability to comment on individual ways means that the website could be hijacked by bad actors. As such I felt the need to ensure that users must sign up for an account to verify their legitimacy. This would also give me the benefit of being able to moderate comments added by users.
The website features an admin area accessible to authorised administrators and moderators that allows management of users and moderation of submitted content. This is a bespoke authentication system purpose built by myself, featuring email verification, password reset and recovery, role based access controls.
A great resource for equestrians
The UK Bridleway Finder map has proven to be a great resource for equestrians, with users numbers steadily increasing and crowd sourced information on the state of bridleways is being added to the database.
If you would like a similar system built for your business, why not get in touch and see if I can help bring your ideas into reality.