geofabrik / OpenRailRouting

routing on railway tracks using OpenStreetMap data and the GraphHopper routing engine
Apache License 2.0
168 stars 30 forks source link

OpenStreetMap based routing on railway tracks

This is a prototype of a routing engine for railways based on a forked version of the GraphHopper routing engine and OpenStreetMap data.

Features

Following features are currently supported:

The configured vehicle profiles can:

Missing features:

Web Frontend

This project includes a web frontend which is a fork of the original GraphHopper web frontend.

Building

This project uses Maven (for the Java code) and NodeJS for the web frontend for building. npm has to be installed.

git submodule init
git submodule update
mvn clean install

JUnit 5 is used for unit tests.

Configuration

You can configure OpenRailRouting by editing its GraphHopper configuration (YAML file). Please refer to config.yml for details.

Profiles

Each route request has to specify a profile. The available profiles are determined by the configuration when the graph is imported. Each profile consists of

You can add an additional directory to the custom models search path by:

graphhopper:
  custom_models.directory: path/to/your/custom_models_directory

If you have your own separate custom models directory, you do not have to recompile OpenRailRouting after every change of the models.

Please refer to the GraphHopper documentation about custom models for a detailed explanation how custom models work. The following contains a few notes about differences between GraphHopper and OpenRailRouting.

In addition to the encoded values supported by GraphHopper, OpenRailRouting can encoded the following encoded values per edge:

In order to make use of these encoded values, you have to set them in the GraphHopper configuration using:

graphhopper:
  graph.encoded_values: gauge,voltage,electrified,frequency,road_environment,max_speed,rail_access,rail_average_speed,railway_class,railway_service

If an edge has multiple gauges, voltages, freuqencies or types of electrification (e.g. multi-gauge tracks or tracks), the edge is duplicated during import. As author of a custom model, you don't need to take this into account.

OpenRailRouting provides a few basic profiles where you can combine and built upon:

Don't forget that clients can submit their own profiles at runtime if they use POST requests.

Running

To run the routing engine, execute

java -Xmx2500m -Xms50m \
  -Ddw.graphhopper.datareader.file=$OSMFILE \
  -jar target/railway_routing-0.0.1-SNAPSHOT.jar ACTION [ARGUMENTS] CONFIG_FILE [OPTARG]

The tool currently supports three different actions (ACTION above):

Import

Arguments:

Required settings to be given either as Java system properties (-Dgraphhopper.datareader.file=PATH or in the YAML file):

Serve

Required settings to be given either as Java system properties (-Ddw.KEY=VALUE or in the configuration file):

Match

Required settings to be given either as Java system properties (-Ddw.KEY=VALUE or in the configuration file):

Following arguments have to be provided (not as Java system variables). You can retrieve this list by calling java -jar target/railway_routing-0.0.1-SNAPSHOT-jar-with-dependencies.jar match config.yml

Optional command line arguments:

License

See LICENSE.txt

See THIRD_PARTY.md for a list of all third-party code in this repository

Thank you

Development of this project has been supported by Geofabrik and SNCF.