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

Download and Install Dependencies

  1. Open your terminal application of choice (PowerShell, Command Prompt, Git Bash, etc.).
  2. Install the necessary dependencies by running the following command:
npm install -g osrm

Download OSRM maps

  1. Go to Geofabrik and select the region you want to download the OSRM data (maps) for.
  2. Download the .osm.pbf file for the desired region.
  3. Place the .osm.pbf file in a directory of your choice. For the purposes of this tutorial, we will assume it is placed in C:\OSRM.

Create OSRM profile

  1. Create a new directory for the profile in the same location as the .osm.pbf file. For example, C:\OSRM\profile.
  2. Download the OSRM profile lua script of your choosing. For example, for a standard car profile, download the car.lua.
  3. Save the downloaded .lua script in the profile directory created in step 1.
  4. 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.

  1. Run the following command to preprocess the extracted data:
osrm-partition C:\OSRM\region.osrm
  1. Run the following command to further optimize the preprocessed data:
osrm-customize C:\OSRM\region.osrm

Start the OSRM server

  1. Start the server by running the following command:
osrm-routed C:\OSRM\region.osrm
  1. 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.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!