← Research

Working paper

Mapping informal buses from riders' own trips: a shared city graph for Port Harcourt

Project: Sabigo

Abstract

Most people in Nigerian cities move by minibuses that run on routes no map records, stop where no sign stands and charge fares no one publishes. This paper describes the data model behind Sabigo, a platform that learns these routes from riders. Riders record a trip on their phone and tap each bus stop on the way. Staff review every stop before anything goes public. Instead of storing each recording as its own route, Sabigo stores one graph per city: stops are shared nodes, and the road between two stops is a shared one-way edge. A new recording that repeats, extends, shortens or branches off earlier ones adds evidence to the same graph. The paper covers how many taps become one stop, how an edge follows the road the bus actually drives, how rides are related to each other while still in review, and how a trip is planned from any point to any point. The first city is Port Harcourt.

Status: working paper, October 2026. The journal it will be submitted to will be listed here.

1. The question

If one rider records and labels a route, and while it is still in review another rider records a subset, a superset, a branch or a completely different route that connects to it, how are the two associated?

Digital Matatus (Nairobi). A team from the University of Nairobi and American universities, including MIT, rode all 135 matatu routes with phones, logged a GPS trail and marked every stop, then published the network in GTFS, the format trip planners read. GTFS expects timetables and calendars that matatus do not have, so the team worked with the GTFS community on a version that fits informal service. They held workshops with the transport community to read the data and released everything openly. The resulting map was adopted by the city (Williams et al., 2015).

Danfo Mapping Project (Lagos). Led by the Lagos Urban Development Initiative in 2022, with support from the World Bank, WhereIsMyTransport and LAMATA, it mapped more than 2,500 danfo routes. The team noted that stops come and go and routes shift from week to week (MIT Atlas of Popular Transport).

danfo.ng (Lagos, 2026). An independent summer research project preparing a one-route pilot. Riders scan on boarding and their phones record the trip; many partial traces laid over each other are meant to reveal routes, stops (where buses pause long enough to count) and fares. Its notes argue for phones over hardware fitted to buses, and name the hard problem as telling a bus stuck in traffic from a rider who has already got off, which it proposes to solve by detecting the change from riding to walking (danfo.ng).

Lara.ng and Google Maps in Lagos. Lara.ng answers like a friend giving directions in a chat and is kept up to date from what users contribute. Google Maps added danfo, keke and BRT to its Lagos directions in 2019.

Stops from GPS traces. Studies in India and South Africa find stops by clustering the places where vehicles pause, and count routes and passenger volumes from vehicle traces (de Beer, Venter and Snyman, 2025).

Map matching. The standard way to fit noisy, sparse GPS points to roads is the Hidden Markov Model of Newson and Krumm (2009).

Boarding between stops. GTFS can already say that riders may board or get off anywhere along part of a route (continuous stops), which is how buses in Port Harcourt work.

3. The model: one graph per city

PieceWhat it is
StopA place buses stop, on one side of the road. A shared node.
Stop across the roadA link between the stop for one direction and the stop for the other.
HopThe stretch from one stop to the next, one way. A shared edge, drawn with the road the bus drove.
EvidenceEvery tap and every recorded line that supports a stop or a hop.
RideOne recording. Private until reviewed.

A ride is an ordered walk over stops and hops. Because the graph is shared, nobody has to decide which “route” a ride belongs to, which matters where routes are fuzzy and drivers change them on the day. For any ride, including one still in review, the system compares its stop sequence with every other ride that shares a stop and labels the pair:

  • same: the same stops in the same order
  • subset: a shorter piece of the other ride
  • superset: a longer ride that contains it
  • branch: they share hops, then split at a stop and may join again later
  • reverse: the same road in the other direction, matched through stops across the road
  • crosses: they share a stop but no hop

A reviewer therefore sees “this ride is a branch of ride X at stop Y” before approving it.

4. From many taps to one stop

Riders tap at slightly different places, and buses do not stop on one exact spot. Every tap is kept. A stop’s position is the middle of its approved taps, weighted by GPS accuracy, so a tap accurate to 5 m counts for more than one accurate to 30 m. Each stop has a zone: the circle that holds 80% of its taps, plus 10 m, kept between 20 and 60 m. A new tap joins a stop if it falls inside the zone, or within 60 m with a matching name. It does not join a stop whose buses travel the opposite way (a heading more than 100° off), so the two sides of a road stay two stops.

Clustering pauses, as in the GPS studies above, finds stops without anyone tapping. Sabigo starts from taps because a tap carries a name and a photo; pause clustering is a later addition to suggest stops that riders missed.

5. Edges follow the road the bus drives

A hop is never drawn as a straight line between two stops. Its line is the best rider recording of that stretch: no jump longer than 200 m between points (a GPS gap), and the length closest to the typical one, which drops detours. A hop with no good recording is flagged as needing a ride. Where OpenStreetMap has the roads, each hop is also matched to road segments; where it has none, the riders’ own GPS is the line.

Many riders on the same road add evidence rows, not new stops or hops. In October 2026 the live data held 11,112 GPS points from 43 rides, about 90 KB per ride. Raw points leave the database 14 days after review and are kept as one compressed file per ride, so every hop can be rebuilt if the method improves.

6. Planning a trip

A trip can start and end anywhere: a stop, a named place or a dropped pin. The planner looks for stops within walking distance and for roads a Sabigo bus drives within 300 m (riders flag buses down and ask to be dropped between stops). It then searches the graph and returns options as walk, one or more buses, walk, with time, number of buses, walking distance, and fare where riders have reported one. A new bus begins where no single recorded ride covers both the hop before and the hop after.

7. Export to GTFS

Stops map to stops.txt, hop lines joined along a pattern to shapes.txt, repeated stop sequences to routes.txt and trips.txt, median hop times to frequency-based stop_times.txt, and boarding between stops to continuous_pickup and continuous_drop_off.

8. Comparison

Digital MatatusDanfo Mapping Projectdanfo.ngSabigo
Who collectsResearch teamProject teamRiders (scan on boarding)Riders, reviewed stop by stop
What is storedRoutesRoutesTraces to be overlaidOne shared graph of stops and hops
Staying currentRe-surveysRe-mappingContinuous tracesEvery ride adds evidence
OutputOpen GTFS, paper mapMap and dataPlanned: routes, stops, live, fares, safetyDirections, GTFS export, bookable seats

9. Limits and next steps

  • Careless or false recordings: stop-by-stop review and support from repeat rides now; scoring how well a ride agrees with others next.
  • Routes that change by time of day: hops carry times, so patterns by hour can be measured.
  • Map matching: compare the current nearest-road method with HMM matching on Port Harcourt rides.
  • Stops nobody taps: suggestions from pause clustering.

10. Evaluation plan

Stop position error against a surveyed sample, hop line error against roads, coverage growth per ride, and trip plans compared with real trips. Logging now: taps per stop, zone sizes, hops needing a ride, rides per week and time from ride to approval.

References

  1. Williams, S., White, A., Waiganjo, P., Orwa, D., Klopp, J. (2015). The digital matatu project: Using cell phones to create an open source data for Nairobi’s semi-formal bus system. Journal of Transport Geography 49: 39–51. dspace.mit.edu/handle/1721.1/120152
  2. Digital Matatus. digitalmatatus.com
  3. From Danfo to Data: Mapping the Movement of Lagos. MIT Atlas of Popular Transport. atlasofpopulartransport.mit.edu/lagos
  4. danfo.ng: Mapping how Lagos really moves (2026). danfo.ng
  5. Newson, P., Krumm, J. (2009). Hidden Markov Map Matching Through Noise and Sparseness. ACM SIGSPATIAL GIS. microsoft.com/research
  6. de Beer, L., Venter, C., Snyman, L. (2025). Quantifying informal public transport using GPS data. Journal of Transport Geography 128. repository.up.ac.za
  7. GTFS: Flexible services and continuous stops. gtfs.org