OSRM (Open Source Routing Machine, maintained by the Project OSRM open-source community under the MIT / BSD-style open-source terms) is a high-performance C++ routing engine designed to compute shortest and fastest paths on OpenStreetMap (OSM) road networks. Built for low-latency HTTP routing, distance/duration matrices, trip optimization, and nearest-road snapping, OSRM lets GIS engineers, web developers, and logistics teams run fast self-hosted routing services on Linux, macOS, and FreeBSD or via Docker containers.
1. In-Depth Review: Why GIS & Mapping Teams Use OSRM
- High-Speed C++ Pathfinding on OSM Networks: Processes large OpenStreetMap extracts into pre-built routing graphs so route, table, and nearest queries return results in milliseconds.
- MLD & Contraction Hierarchies (CH) Routing Modes: Supports Multi-Level Dijkstra (MLD) for flexible customization and Contraction Hierarchies (CH) for ultra-fast shortest/fastest path queries.
- Ready-to-Use HTTP Routing, Table, Trip & Match APIs: Provides clean HTTP JSON endpoints for point-to-point routes, origin-destination matrices, multi-stop trips, and GPS trace matching.
2. Key Features & Capabilities
- Turn-by-Turn Route Calculation: Compute driving, cycling, or walking routes with step-by-step maneuvers, distance, duration, and GeoJSON/polyline geometry.
- Distance & Duration Matrix Service (`table`): Calculate travel times and distances across many origins and destinations for spatial accessibility and logistics analysis.
- Traveling Salesperson / Trip Service (`trip`): Optimize multi-stop routes across waypoints cleanly.
- Nearest & Map-Matching Services (`nearest` / `match`): Snap coordinates to the closest network segment and match GPS tracks onto road geometries.
- Lua Profile Customization: Tailor speed, access, and vehicle rules using Lua routing profiles during graph extraction.
- Free & Open-Source Software: Free to self-host and inspect source code and releases on GitHub.
- Official Links: Free Trial, Free / Education & Pricing
Always download OSRM source releases, packages, and documentation directly from official Project OSRM portals:
- Official OSRM Project Website: http://project-osrm.org/
- Official OSRM Backend GitHub Repository: https://github.com/Project-OSRM/osrm-backend
- Official OSRM Releases Page: https://github.com/Project-OSRM/osrm-backend/releases
- OpenStreetMap Wiki — OSRM Guide: https://wiki.openstreetmap.org/wiki/Open_Source_Routing_Machine
4. Step-by-Step Installation Guide
- Check Operating System & Build/Container Tools: Confirm your Linux, macOS, or FreeBSD machine (or Docker host) has adequate RAM and fast SSD storage for preparing OSM routing data.
- Download Source Release or Pull OSRM Package/Image: Visit https://github.com/Project-OSRM/osrm-backend/releases or https://github.com/Project-OSRM/osrm-backend to get the latest release source (`26.11.0` series) or build/install `osrm-extract`, `osrm-partition`, `osrm-customize`, and `osrm-routed`.
- Download a Regional `.osm.pbf` Extract: Obtain the `.osm.pbf` OpenStreetMap extract for your country or province and place it in your data directory.
- Prepare Routing Graph & Start `osrm-routed`: Run the extraction and partitioning/customization steps on your `.osm.pbf` file, then launch `osrm-routed` and test a sample route query.
5. How to Use OSRM: Beginner Workflow
- Prepare Your `.osm.pbf` File & Profile: Place your target `.osm.pbf` dataset and select a routing profile (such as `car.lua`, `bicycle.lua`, or `foot.lua`).
- Extract & Build the Routing Graph: Run `osrm-extract` followed by `osrm-partition` and `osrm-customize` (for MLD) to generate the routing graph files from your OSM data.
- Start the `osrm-routed` HTTP Server: Launch `osrm-routed` pointing to your prepared `.osrm` dataset so it listens for incoming HTTP routing requests.
- Send Route or Matrix HTTP Requests: Query the OSRM HTTP endpoint with origin and destination coordinates (`lon,lat;lon,lat`) to receive route distance, duration, steps, and geometry.
- Display Routes in Web Maps or GIS Workflows: Parse the returned GeoJSON or polyline coordinates in your web GIS app, Leaflet/MapLibre client, or spatial script.
6. Frequently Asked Questions (FAQ)
- Is OSRM free to self-host and use?Yes. OSRM is an open-source routing engine with source code and releases published on GitHub.
- What input map data does OSRM use?OSRM builds its road network routing graph from OpenStreetMap (`.osm.pbf`) data using Lua routing profiles.
- Which operating systems support OSRM?OSRM runs on Linux, macOS, and FreeBSD, and is commonly deployed on Linux servers or in Docker containers.