Repolode
Project-OSRM

Project-OSRM/osrm-backend

High-performance C++ routing engine that computes routes, distance tables, GPS map matching and more on OpenStreetMap data.

Open-source alternative to:Google Maps Platform Directions API

Stars
8,195
Forks
3,979
Open issues
374
Last commit
5 days ago

What is it?

OSRM (Open Source Routing Machine) is a routing engine written in C++ that runs on OpenStreetMap road network data. It exposes its services through an HTTP API, a C++ library interface, and a Node.js wrapper, with a Python binding also available.

The engine covers six services: nearest (snapping coordinates to the street network), route (fastest path between coordinates), table (durations or distances between all pairs of points), match (snapping noisy GPS traces to roads), trip (solving the Traveling Salesman Problem with a greedy heuristic), and tile (generating Mapbox Vector Tiles with routing metadata).

The project supports two preprocessing pipelines, Multi-Level Dijkstra (MLD, the recommended default) and Contraction Hierarchies (CH). Docker images are provided for a quick start, and building from source uses vcpkg for dependencies.

Key features

  • 01Route, nearest, table, match, trip and tile services over OpenStreetMap data
  • 02HTTP API, C++ library, Node.js and Python bindings
  • 03MLD and CH preprocessing pipelines
  • 04Docker images for quick setup
  • 05Custom routing profiles via Lua scripts

Use cases

  • Building a self-hosted routing or navigation backend on OpenStreetMap data
  • Computing large travel-time or distance matrices for logistics and dispatch
  • Map-matching GPS traces from vehicles or fitness devices to the road network
  • Solving small vehicle routing or TSP-style visit ordering problems

Quick start

  1. 1

    Download an OpenStreetMap extract (Berlin example)

    wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
  2. 2

    Pre-process the extract with the car profile using Docker

    docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf || echo "osrm-extract failed"
  3. 3

    Partition the extract (then run osrm-customize the same way, as in the README)

    docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm || echo "osrm-partition failed"
  4. 4

    Start the routing HTTP server on port 5000

    docker run -t -i -p 5000:5000 -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm

Things to know

  • Processing large OpenStreetMap extracts can take a very long time, for example about 30 minutes for a 550 MB file.
  • Building from source needs a C++20 compiler, CMake 3.29 or newer, and vcpkg, and the first configure compiles many dependencies.

Topics

FAQ

What is osrm-backend?
High-performance C++ routing engine that computes routes, distance tables, GPS map matching and more on OpenStreetMap data. OSRM (Open Source Routing Machine) is a routing engine written in C++ that runs on OpenStreetMap road network data. It exposes its services through an HTTP API, a C++ library interface, and a Node.js wrapper, with a Python binding also available.
Is osrm-backend free to use? What license does it have?
osrm-backend is open source under the BSD-2-Clause license. Check the license terms before using it in commercial products.
Is osrm-backend still maintained?
Actively maintained. The last commit to osrm-backend was on Nov 2, 2026.
What can I use osrm-backend for?
Building a self-hosted routing or navigation backend on OpenStreetMap data Computing large travel-time or distance matrices for logistics and dispatch Map-matching GPS traces from vehicles or fitness devices to the road network Solving small vehicle routing or TSP-style visit ordering problems
How do I install osrm-backend?
Download an OpenStreetMap extract (Berlin example): wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf Pre-process the extract with the car profile using Docker: docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf || echo "osrm-extract failed" Partition the extract (then run osrm-customize the same way, as in the README): docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm || echo "osrm-partition failed" Start the routing HTTP server on port 5000: docker run -t -i -p 5000:5000 -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
Where can I get osrm-backend?
The source code and installation instructions are on GitHub: https://github.com/Project-OSRM/osrm-backend

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects