Multi-modal routing with OSM data

From Open source mapmaking technologies
Jump to: navigation, search

OpenTripPlanner (OTP) is an open source multi-modal trip planner, which runs on Linux, Mac, Windows, or potentially any platform with a Java virtual machine.

OpenTripPlanner has online documention available.

How routes are computed

To calculate routes, a mathematical representation of the data is used. This representation is a graph. The graph contains nodes (lots of nodes) and edges that connects two nodes. These edges can have weights assigned. Distance is the most used weight.

Update JAVA

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer


We will use just the Beijing area data to do routing, instead of the data from all China.

osmosis --read-pbf file=italy-latest.osm.pbf --bounding-polygon file=Triest.poly --write-xml trieste.osm

Creating the graph

Crie uma pasta onde vai guardar os dados necessários para o cálculo de grafo de routing:

mkdir -p ~/otp/graphs/trieste
cp trieste.osm ~/otp/graphs/trieste
ls -l ~/otp/graphs/trieste

O resultado do último comando ls será algo do género:

total 176704
-rw-rw-r-- 1 jgr jgr 180943474 Jul  4 16:21 trieste.osm

Estamos em condições de descarregar o software OpenTripPlanner e gerar o grafo:

cd ~/otp
java -jar otp-0.19.0-shaded.jar --build ~/otp/graphs/trieste

The resulting graph is:


Running OTP

To start OpenTripPlanner server:

cd ~/otp
java -Xmx2G -jar otp-0.19.0-shaded.jar  --server --port 9090 --basePath . --graphs graphs --router trieste --analyst

To access OpenTripPlanner client application:


Calculate a route

Select the start and end location. Selected Travel by: Drive Only or Walk Only.

OTP Trieste province.png