Mapweaver/OSRMW

From OpenStreetMap Wiki
Jump to: navigation, search

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

Changelog

v.0.1 Initial release

Installation

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
scons

Assuming you have the last mapweaver (0.37+) in the folder ~/Desktop/mapweaver, download OSRM archive from http://sourceforge.net/projects/routed/files/ (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
scons

Perl modules

Download (see links at bottom) osrm.pm and osrmlib.pm in the SAME folder as OSRM executables (so ~/Desktop/mapweaver/osrm/) and osrmw_data.pl and osrmw.pl in the SAME folder as mw.pl (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 (osrmw_data.pl) which automates this process: call it with "perl osrmw_data.pl 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

Using osrmw.pl

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

Download