How to Install Open Source Routing Machine (OSRM) on Windows 11
Open Source Routing Machine (OSRM) is a tool that provides an efficient solution for routing problems in the field of transportation. In this tutorial, we will guide you through the step-by-step process of installing OSRM on a Windows 11 operating system.
Prerequisites
- A computer running Windows 11
- A working internet connection
- Node.js and Git version control system already installed
Download and Install Dependencies
- Open your terminal application of choice (PowerShell, Command Prompt, Git Bash, etc.).
- Install the necessary dependencies by running the following command:
npm install -g osrm
Download OSRM maps
- Go to Geofabrik and select the region you want to download the OSRM data (maps) for.
- Download the
.osm.pbffile for the desired region. - Place the
.osm.pbffile in a directory of your choice. For the purposes of this tutorial, we will assume it is placed inC:\OSRM.
Create OSRM profile
- Create a new directory for the profile in the same location as the
.osm.pbffile. For example,C:\OSRM\profile. - Download the OSRM profile lua script of your choosing. For example, for a standard car profile, download the
car.lua. - Save the downloaded
.luascript in the profile directory created in step 1. - Create the OSRM profile by running the following command:
osrm-extract -p C:\OSRM\profile\car.lua C:\OSRM\region.osm.pbf
Note: Replace C:\OSRM\region.osm.pbf with the path to the .osm.pbf file on your system.
- Run the following command to preprocess the extracted data:
osrm-partition C:\OSRM\region.osrm
- Run the following command to further optimize the preprocessed data:
osrm-customize C:\OSRM\region.osrm
Start the OSRM server
- Start the server by running the following command:
osrm-routed C:\OSRM\region.osrm
- The OSRM server is now serving requests on
http://localhost:5000.
Conclusion
In this tutorial, we have covered the step-by-step process of installing and configuring the Open Source Routing Machine (OSRM) on a Windows 11 operating system. By following these steps, you should now have a working OSRM server on your local system.