Minimal FOSS Public Transportation Router based on Dijkstra's Algorithm & GTFS. Currently in development & testing.
Refactor - extract ConvertStopTimesMapToArrayStopTimes logic to fn
Cleanup mepo script integrations
add script to show stop times on cursor


browse  log 



You can also use your local clone with git send-email.


Disclaimer: Mobroute is in active development and pre-0.1 and as such is currently aimed at early adopters and those who wish to help with testing. In it's current state Mobroute is at a proof-of-concept stage, routing works for select metros. See the mailing list note for more project details.

Mobroute is a minimal FOSS public-transportation router and suite of tools allowing you to route between locations by using public transportation data (GTFS) data. GTFS feeds are automatically fetched from the from the Mobility Database and the application is designed to have as few 'knobs' to adjust before being practically useful. The core of the routing algorithm is based on graph traversal using Dijkstra's algorithm.

Also - in addition to routing, Mobroute provides auxiliary support for functionality using the same GTFS data including: stop times / timetables lookups for nearby stations, assistance finding all nearby stations, and graph building.

Providing a commandline interface, Mobroute support several different output formats including: ASCII, Mepolang, and GeoJSON. The ASCII format can be used by end users who don't need any visual representation and simply want a series of steps for a route (e.g. board the A train in 2 mins etc.). Using the Mepolang format, Mobroute integrates with Mepo, the graphical minimal opensource OSM viewer to visually place routes onto the map as an ordered pingroup. And finally, by using the GeoJSON output format you may integrate Mobroute into your own mapping or custom application.

Compared to other Opensource Routers (such as GraphHopper, OpenTripPlanner, Valhalla, et al.):

  • Mobroute focuses exclusively on GTFS data; most other routers are based around OSM/PBF data
  • Mobroute integrates with the MobilityDatabase out-of-the-box
    • Thus the user does not need to lookup the source for their GTFS data
    • Rather, the user can specify a regex or name match for the GTFS source based on the MobilityDatabase's provided feeds and the rest is handled automatically.
    • Other routers typically have a GTFS 'import' feature; but do not feature automatic import (and caching) of GTFS data.
  • Mobroute aims toward minimalism & the UNIX philosophy (e.g. do one-thing-well)
    • Only focusing on routing via GTFS data, Mobroute is single-focused
    • Mobroute has no concept of OSM/PBF walk/drive routes and is aimed toward practical usage
    • Mobroute does however nicely pair with Mepo which can provide graphical routes via OSM
  • Mobroute offers a commandline interface rather then a server-client architecture
    • Mobroute is designed to be used 'on-device'/locally and offline
    • Other routers are based on client-server architecture
    • Mobroute targets end usage on low-spec'd devices such as the Pinephone and postmarketOS devices
  • Mobroute codebase and routing implementation aims to be small & simple
    • The core routing algorithm is based on Dijkstra's algorithm
    • The codebase is written in Go (opposed to Java or C++ as with the aforementioned routers)

What can be done with Mobroute today:

  • route command:
    • Route to/from based on geocoordinates
    • Based on creation of graph using Dijkstra's algorithm
    • Calculates most efficient route (including transfers)
  • stops command:
    • Lookup nearby stops based on input geocoordinate
  • stoptimes command:
    • Determine stoptimes and routes for nearest stops based on input geocoordinate
  • graph command:
    • Create & output shortest path graph based on Dijkstras algorithm
  • mobdb command:
    • Outputs the mobility database, the field Handle may be used to with -gtfsregex to match against


Note, in all examples there will be an initial cost for downloading the Mobility DB and the targeted GTFS source file. Once downloaded initial, the GTFS file is cached and subsequent commands will run quicker.

A. Route: Route from Grand Palace to the Hilton Garden, Brussels

mobroute \
  -gtfsregex '.+bruxelles.+' \
  -cmd route \
  -lat 50.85728 \
  -lon 4.351426 \
  -dlat 50.83214 \
  -dlon 4.350534

B. Stops: Display nearby stops near the Grand Palace, Brussels:

mobroute \
  -gtfsregex '.+bruxelles.+' \
  -cmd stops \
  -lat 50.85728 \
  -lon 4.351426

C. Stoptimes: Display stoptimes and departure times for stops near the Grand Palace, Brussels:

mobroute \
  -gtfsregex '.+bruxelles.+' \
  -cmd stoptimes \
  -lat 50.85728 \
  -lon 4.351426

D. Mobility DB: Display the Mobility DB (note the Handle field can be matched against using the -gtfsregex flag):

mobroute -cmd mobdb

#Integration with Mepo:

Mobroute was built with Mepo in mind; in future releases of Mepo, mobroute will automatically be integrated (e.g. menuing for various mobroute operations). Until then, mobroute may still be integrated by performing the following:

./build.sh install

This will install both the mobroute executable and a script mepo_menu_mobroute.sh to /usr/local/bin. Once installed, launching the central menu within mepo, you'll see new entries for Route: via Mobroute directions and Route: show Mobroute stoptimes on cursor.

Do note, that by default Mobroute is configured to use NYC's subway system GTFS file. This can be changed by configuring a few variables set in mepo_menu_mobroute.sh which are exported as ENV variables.

Debugging can also be accomplished with Mepo by using the -i feature on mepo's cli, e.g.:

mobroute -cmd route -format mepolang | mepo -i

#Demo Videos