Nicolas Raymond / Nicolas Tortrat--Gentilhomme, 2014/2015
The OpenStreetMap-PathFinder is a command line tool that allows you to compute itineraries for pedestrians, bicycles and motorized vehicles on maps coming from OpenStreetMap.org.
OSM-Pathfinder can extract data from OSM files and display the path that you have requested in two different formats:
- A graphical and visual format stored as a jpeg file.
- A textual format that gives you a roadmap discribing your itinerary.
This project is a study work realized by a team at the University Paris Diderot, Paris 7.
OSM-PathFinder at least needs the 4.02.0
version of OCaml and uses different packages:
xml-light
lablgtk
camlimages
ocamlbuild
The easiest way to install them is to use the OPAM package manager.
$ sudo apt-get install opam
$ opam init
$ eval `opam config env`
Use homebrew.
$ brew install Caskroom/cask/xquartz
$ brew install ocaml --with-x11
$ brew install opam
$ opam init
$ eval `opam config env`
Note: You will probably have to reboot your computer after these commands because of the installation of XQuartz.
The lablgtk
and camlimages
packages need a recent version of gtk+
.
$ sudo apt-get install libgtk2.0-dev libjpeg-dev
$ brew install gtk+
$ opam install ocamlbuild lablgtk camlimages xml-light
$ eval `opam config env`
Clone this repo at a desired place on your computer.
A simple make
in the root of the project will produce the runnable osm_pathfinder
A make doc
will generate an ocamldoc documentation in the doc
subdirectory.
Note: The following examples will use an OpenStreetMap file not included in this repo in order to keep it light. If you want to do some tests on the same file and use exactly the same commands, you might clone that repo at the root of the project.
To compute an itinerary, OSM-PathFinder must at least be used with the following command line:
$ ./osm_pathfinder -f <map>.osm {starting and ending points}
where:
- option
-f
allows to select the OSM file (<map>.osm
) to work with. {starting and ending points}
allows to select the starting and ending point of your itinerary. These points could be defined by three different ways:-n <nodeID1> <nodeID2>
wherenodeID1
andnodeID2
are integers to directly select them from OSM nodes with their fieldid
.-c <latitude1>/<longitude1> <latitude2>/<longitude2>
to select theme from coordinates in latitude and longitude.-a <address1> <address2>
to select theme from addresses. (Not implemented yet)
$ ./osm_pathfinder -f MapExample/example.osm -c 48.6499/2.3648 48.6890/2.38233
will compute the itinerary on the map MapExample/example.osm
from the point of coordinates 48.6499/2.3648
to the point of coordinates 48.6890/2.38233
.
By setting the vehicle, OSM-PathFinder will compute the itinerary for the circulating form you have chosen. You can use:
--motorized
or-m
for a motorized vehicle (car / motocycle) itinerary. (default)--bicycle
or-b
for a bicycle itinerary.--pedestrian
or-p
for a pedestrian itinerary.
Two kinds of itinerary are available:
--distance
or-d
will set the itinerary to be the shortest in distance. (default)--time
or-t
will set the itinerary to be the shortest in time.
The itinerary can be displayed in two formats:
--roadmap
or-r
will print the itinerary as a roadmap, explaining you all the steps to travrel through it. (default)--graphical <image>.jpg
or-g <image>.jpg
will draw the map, the itinerary and will save the result in the image file<image>.jpg
. The itinerary will be represented by a red line, the starting point by a green dot and the destination by a blue one.
The first time OSM-PathFinder will handle an OSM file, it will extracts his data in order
to use it. Also, the first time you will use the --graphical
option, it will draw the
map from the data it has extracted.
This first treatments can be quite long due to the very large size of OpenStreetMap files,
but fortunately, they have to be computed only once. The next times OSM-PathFinder will
handle the same file, the global processing should be drastically faster.
The command line:
$ ./osm_pathfinder -P -f <map>.osm
will run all those pre-treatments separatly. It can be useful if you want to use the tool in a server application and only re-process the maps if they have been updated.
The command line:
$ ./osm_pathfinder -h
will prints you the usage of the software.
$ ./osm_pathfinder --motorized --time --roadmap -f MapExample/example.osm -c 48.6603/2.3774 48.6890/2.38233
will produce the following roadmap:
$ ./osm_pathfinder --bicycle --distance --graphic myItinerary.jpg -f MapExample/example.osm -c 48.6603/2.3774 48.6890/2.38233
will produce the file myItinerary.jpg
with this picture: