How to Install Open Source Routing Machine (OSRM) on Windows 10

The Open Source Routing Machine (OSRM) is a high-performance routing engine which is designed to provide the fastest routes in road networks. OSRM is used in a variety of applications such as ride-sharing services, logistics and transportation planning. Installing OSRM on Windows 10 involves several steps which are outlined below.

Step 1: Install Dependencies

Before installing OSRM, it is important to install the following dependencies:

Step 2: Compile OSRM

Once you have installed the dependencies, you can compile OSRM by following these steps:

  1. Open the command prompt by pressing Windows Key + R and typing cmd.
  2. Navigate to the directory where you want to install OSRM by running the command cd <directory>.
  3. Clone the OSRM repository using Git by running the command git clone https://github.com/Project-OSRM/osrm-backend.git.
  4. Navigate to the cloned directory by running the command cd osrm-backend.
  5. Create a build directory by running the command mkdir build.
  6. Navigate to the build directory by running the command cd build.
  7. Run the command cmake .. -G "Visual Studio 16 2019" -A x64.
  8. Once the command has finished running, open the generated .sln file in Visual Studio.
  9. In Visual Studio, select Build > Build Solution from the menu.
  10. After the build is completed successfully, the OSRM libraries will be located in osrm-backend/build/lib/.

Step 3: Generate OSRM Data

The next step is to generate the OSRM data by following these steps:

  1. Navigate to the directory where you downloaded LibOSRM.
  2. Extract the downloaded .osm.pbf file. This file contains the OpenStreetMap data.
  3. Open the command prompt by pressing Windows Key + R and typing cmd.
  4. Navigate to the directory where you compiled OSRM by running the command cd <directory>/osrm-backend/build.
  5. Run the command osrm-extract -p ../profiles/car.lua path/to/your/file.osm.pbf.
  6. Run the command osrm-partition path/to/your/file.osrm.
  7. Run the command osrm-customize path/to/your/file.osrm.

After the above steps, the generated OSRM data will be located in the same directory as the .osm.pbf file.

Step 4: Testing

Finally, test if OSRM is working by following these steps:

  1. Open the command prompt by pressing Windows Key + R and typing cmd.
  2. Navigate to the directory where you generated the OSRM data by running the command cd <directory>.
  3. Run the command osrm-routed path/to/your/file.osrm.
  4. Open a web browser and navigate to http://localhost:5000/route/v1/driving/<location1>;<location2>?steps=true. Replace <location1> and <location2> with the latitude and longitude of two locations you want to route between.
  5. If everything works correctly, you should get a JSON response containing the route information.

Congratulations, you have installed and tested OSRM on Windows 10. You can now use OSRM in your own applications!

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!