From OpenStreetMap Wiki
Jump to: navigation, search

A Mapweaver extension to draw routes between two points using OSRM as routing engine.


v.0.1 Initial release


Compiling OSRM

Install dependencies: you'll need at least these packages

sudo apt-get install sparsehash libsparsehash-dev libboost-dev g++ libxml2 libxml2-dev scons libstxxl1 libstxxl-dev

Assuming you have the last mapweaver (0.37+) in the folder ~/Desktop/mapweaver, download OSRM archive from (wgetting them it's at own risk) and put in mapweaver folder, then unpack and build

cd ~/Desktop/mapweaver
tar xfvz osrm_0.2.tar.gz
cd osrm

Perl modules

Download (see links at bottom) and in the SAME folder as OSRM executables (so ~/Desktop/mapweaver/osrm/) and and in the SAME folder as (so ~/Desktop/mapweaver/).

One more step to go: install two perl modules

sudo cpan Geo::KML
sudo cpan Geo::Gpx

Preparing files for routing

Now it's time to make files for the Routing Machine. The osrmw package offers a script ( which automates this process: call it with "perl osmfile.osm" (where osmfile is the name of your osm file). In detail here's the steps:

1. `extractLargeNetwork osmfile.osm`

2. `createHierarchy osmfile.osrm`

3. edit server.ini with paths to these created files


The program needs three parameters:

--routed: Path to routed executable
--osrm : File.osrm (main file)
--nodes : OSM id of starting and ending node seperated by comma

Things which should be done

There are some things left:

  • provide a way to insert directly coordinates instead of nodes
  • allow to provide extra parameters for mapweaver [this is easily done by user-side customizing mwconfig.ini and mwstandardrules.txt]
  • remove gpx as default operation, leaving an option to mantain the file