railnova / osrm-train-profile

A train profile for OSRM
BSD 2-Clause "Simplified" License
24 stars 17 forks source link
dijkstra locomotive openstreetmap osm osrm railway routing-profile shortest-path

OSRM Lua profile for trains

This repo contains a profile for routing (mostly freight) trains with OSRM. This enables you to find the shortest path by train between 2 points and also do map matching with OSRM.

Note: travel time estimations are way too optimistic due to the red lights, stations and traffic not taken into account

Right now, it contains, 2 profiles :

basic.lua

A basic/naive profile that works quite well.

freight.lua

A profile optimized for freight trains:

Possible improvements that we might one day include :

screenshot of the demo

Inspiration for the code taken from an old russian blog and the car profile

How to run this?

First, you will need to install the Docker daemon and osmium (osmium-tool on Ubuntu) on your machine. Then, run make all to download the OSM data, filter and combine it and finally compute the routing graph.

Last, run make serve to serve the OSRM server locally on port 5000

License

This code is under the 2-Clause BSD License.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.