mobroute

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2023 License: GPL-2.0 Imports: 13 Imported by: 0

README

Mobroute

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.
    • 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 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

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 Organic Maps/Termux (Android):

In the future a native integration with mobile Android/iOS client(s) with Mobroute would ideal. In the iterim, if you want to use Mobroute on Android, this is possible today with Organic Maps. This is made possible by running Mobroute from Termux directly in conjunction with using Mobroute's gpx output format.

To perform a routing request in this fashion, follow the below steps:

# Assuming you've installed Termux & Organic Maps

# 1. Install dependencies:
pkg in go git jq

# 2. Setup termux storage sharing
termux-setup-storage

# 3. Create directory to save gpx route output files to:
mkdir /data/data/com.termux/files/home/storage/shared/Mobroute

# 4. Run the provided mrn.sh which prompts for from/to and automatically
#    saves route as a gpx file
scripts/mrn.sh

# 5. Assuming (4) was successful, select the GPX file in your filebrowser
#    and select Organic Maps to plot on the map; or import directly in Organic
#    Maps

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL