OsProject
id  velorail
state  active
owner  WolfgangFahl
title  VeloRail
url  https://github.com/WolfgangFahl/velorail/
version  0.1.4
description  Multimodal bike and train route planning support
date  2026-08-04
since  2025-02-01
until  


Demo

https://velorail.bitplan.com


Installation

pip install velorail
# alternatively if your pip is not a python3 pip
pip3 install velorail 
# local install from source directory of velorail 
pip install .

upgrade

pip install velorail  -U
# alternatively if your pip is not a python3 pip
pip3 install velorail -U


Usage

Command Line

velorail -h
usage: velorail [-h] [-a] [--apache APACHE] [-c] [-d]
                [--debugServer DEBUGSERVER] [--debugPort DEBUGPORT]
                [--debugRemotePath DEBUGREMOTEPATH]
                [--debugLocalPath DEBUGLOCALPATH] [-l] [-i INPUT] [-rol]
                [--host HOST] [--port PORT] [-s] [-V] [-v] [-rp ROOT_PATH]
Multimodal bike and train route planning support
options:
  -h, --help            show this help message and exit
  -a, --about           show about info [default: False]
  --apache APACHE       create an apache configuration file for the given
                        domain
  -c, --client          start client [default: False]
  -d, --debug           show debug info [default: False]
  --debugServer DEBUGSERVER
                        remote debug Server
  --debugPort DEBUGPORT
                        remote debug Port
  --debugRemotePath DEBUGREMOTEPATH
                        remote debug Server path mapping - remotePath - path
                        on debug server
  --debugLocalPath DEBUGLOCALPATH
                        remote debug Server path mapping - localPath - path on
                        machine where python runs
  -l, --local           run with local file system access [default: False]
  -i INPUT, --input INPUT
                        input file
  -rol, --render_on_load
                        render on load [default: False]
  --host HOST           the host to serve / listen from [default: localhost]
  --port PORT           the port to serve from [default: 9876]
  -s, --serve           start webserver [default: False]
  -V, --version         show program's version number and exit
  -v, --verbose         show verbose output [default: False]
  -rp ROOT_PATH, --root_path ROOT_PATH
                        path to pdf files [default:
                        /Users/wf/Library/Python/3.12/lib/python/site-
                        packages/velorail_examples]

REST API

The bounding box route lookup of issue 5 is documented and callable at https://velorail.bitplan.com/docs

The bounding box is given as south, west, north and east in WGS84 degrees. The gpx calls take mode=overlap for routes that touch the box and mode=contained for routes that lie completely inside it.

Route relations of OpenStreetMap

sources is a comma separated list of train and bike; limit caps the result per source.

curl "https://velorail.bitplan.com/api/routes/bbox?south=50.75&west=6.05&north=50.80&east=6.12&sources=train,bike&limit=3"
{
  "status": "ok",
  "bbox": {"south": 50.75, "west": 6.05, "north": 50.8, "east": 6.12},
  "sources": ["train", "bike"],
  "records": [
    {"rel": "...relation/...", "route_type": "railway", "name": "Ronheider Rampe", "source": "train"},
    {"rel": "...relation/...", "route_type": "train", "ref": "ES", "name": "Eurostar: Dortmund → Köln → Bruxelles → Paris", "source": "train"},
    {"rel": "...relation/...", "route_type": "bicycle", "ref": "D4", "name": "[D4] Mittelland-Route (Nordrhein-Westfalen)", "source": "bike"}
  ]
}

Gpx referenced by url

curl "https://velorail.bitplan.com/api/gpx/bbox?gpx_url=https://www.topografix.com/fells_loop.gpx&south=42.40&west=-71.20&north=42.50&east=-71.00&mode=overlap"
{
  "status": "ok",
  "source": "https://www.topografix.com/fells_loop.gpx",
  "mode": "overlap",
  "bbox": {"south": 42.4, "west": -71.2, "north": 42.5, "east": -71.0},
  "route_count": 2,
  "records": [
    {"name": "BELLEVUE", "kind": "route", "point_count": 46,
     "bbox": {"south": 42.43095, "west": -71.122845, "north": 42.46711, "east": -71.105116}}
  ]
}

Posted gpx

curl -X POST -H "Content-Type: application/gpx+xml" \
  --data-binary @velorail_examples/aachen_bike_loop.gpx \
  "https://velorail.bitplan.com/api/gpx/bbox?south=50.75&west=6.05&north=50.80&east=6.12&mode=contained"
{
  "status": "ok",
  "source": "posted",
  "mode": "contained",
  "bbox": {"south": 50.75, "west": 6.05, "north": 50.8, "east": 6.12},
  "route_count": 1,
  "records": [
    {"name": "Aachen city loop", "kind": "track", "point_count": 6,
     "bbox": {"south": 50.7679, "west": 6.0836, "north": 50.7815, "east": 6.1006}}
  ]
}

A failing check answers with status error and a message, e.g. an inverted box:

curl "https://velorail.bitplan.com/api/routes/bbox?south=51&west=6.05&north=50&east=6.12"
{"status": "error", "message": "south 51.0 is north of north 50.0"}

Endpoints and fallback

Queries run against the endpoints of velorail/resources/endpoints.yaml. The wikidata chain falls back from the public qlever node to the RWTH Aachen node and finally to the Wikidata Query Service; a failure is only reported when none of them answers.

Endpoint Url Fallbacks
wikidata-qlever https://qlever.dev/api/wikidata wikidata-qlever-dbis, wikidata
wikidata-qlever-dbis https://qlever-api.wikidata.dbis.rwth-aachen.de/ wikidata-qlever, wikidata
wikidata https://query.wikidata.org/sparql
osm-qlever https://qlever.dev/api/osm-planet
osm-sophox https://sophox.org/sparql

The route queries need OpenStreetMap data and have no second node yet: the RWTH backend list serves wikidata only and osm-planet carries 213.7 G triples against 17.7 G of wikidata.