Node-osrm – An alternativ mapmatching solution

The alternative

After testing and trying to patch the graphhopper map-matching framework, I decided to have a second look for alternative map matching frameworks. After googling for a long while and trying various search terms, I found the Project-OSRM on Github.

The Open Source Routing Machine (OSRM) is a C++ implementation of a high-performance routing engine for shortest paths in road networks. – project-osrm.com

Thankfully this project also comes with a repository containing NodeJS bindings for OSRM. It gives us various wrappers to access the routing functionality. Many examples can be found in the readme on github. The one especially useful for use, as it enables us to do point per point map matching, is:

osrm.locate([52.4224,13.333086], function (err, result) {
  console.log(result);
  // Output: {"status":0,"mapped_coordinate":[52.422442,13.332101]}
});

Setup

The Setup is described in the projects readme as well, however there are a few challenges to tackle:

  • Use the current official node version, as there seem to be bugs under iojs
  • You seem to have to run the make command first, before being able to create supporting files.
  • The node module needs various files, such as *.edges, *.nodes, … to work, which are generated after running the make command as shown in the readme. In order to support map-matching for a bigger area, you need to change the default area (berlin) to the wanted area. Be aware that this might take a lot of time for bigger areas, as it downloads the whole .pbf file from the web (e.g. germany ~2.6 GB)
  • There where a few more challenges, i will update this list as I remember 😉

Results

After setting everything up, some test runs with existing data where made. In general, the map-matching worked pretty well and reasonably fast. However, as this does the map-matching point by point,  there are a few outliers visible. Some pictures of the results can be seen below. Note that the only the pink points are the map matched ones, all other ones are “raw data (e.g. yellow, green, red, …)

screen_shot_2015-05-20_at_13.51.58_1024

Advertisements