~mil/mobroute

Minimal FOSS Public Transportation Router based on Dijkstra's Algorithm & GTFS. Currently in development & testing

a405d26 Split out logic for route/search buttons in seperate files

~mil pushed to ~mil/mobrouteui git

10 hours ago

b3cc3a5 Working scrolling of result

~mil pushed to ~mil/mobrouteui git

11 hours ago

#Mobroute

Disclaimer: Mobroute is in active development 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 the CSA algorithm. Mobroute also provides auxiliary support for functionality using the same GTFS data including: stop times / timetables lookups for nearby stations, assistance finding all nearby stations.

The Mobroute project is composed of 3 seperate codebases / smaller projects:

  • Mobsql is a GTFS-to-SQL ETL tool which pulls GTFS sources from the MobilityDB into a SQLite database. It exposes both a CLI & a Go library (consumed by Mobroute)
  • Mobroute: is the core routing tool. This project handles interfacing Mobsql via its public Go API and then once the DB is loaded, opens the DB and performs routing calculations (currently via Dijkstra's Algorithm). It exposes both a CLI & a Go library (consumed by Mobrouteui)
  • Mobrouteui: is a simple Android & Linux GUI app to use Mobroute. It allows querying from/to via Nominatim and performing routing calculations on-the-go via Mobroute's underlying routing mechanism (note this implicitly integrates Mobsql as well).

Featureset

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.
    • Integration with Mobsql is built in; and additionally Mobsql's GTFS-to-SQL pipeline can be used independent of Mobroute itself.
  • 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 Connection Scan Algorithm 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 CSA'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

#Examples:

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 \
  -f '{glob: 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 \
  -f '{glob: bruxelles}' \
  -cmd stops \
  -lat 50.85728 \
  -lon 4.351426

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

mobroute \
  -f '{glob: bruxelles}' \
  -cmd stoptimes \
  -lat 50.85728 \
  -lon 4.351426

#Integration with Mepo (Mobile Linux):

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

#Integration with Mobrouteui (Android App):

For testing on Android, the Mobrouteui app may be used. This UI allows you to query Nominatim to/from points and calculate a route via Mobroute's ETL flow & algorithm on-the-go on an Android device. The app uses Mobroute's Go code compiled via Gio. This app is in active development alongside Mobroute overall so this app should be viewed as more of a testbed for using Mobroute on-the-go and aimed at early adopters and those who wish to help with testing and development.

#Demo Videos

#Funding

NLnet has kindly awarded a grant to support Mobroute's development efforts as part of the NGI0 Entrust Fund under grant agreement No 101069594. This funding will enable the financial support for implementing of the roadmap as seen in this document. We are very thankful to NLnet for accepting our application and making this development possible.

#Contribute