This tutorial will step by step show you how to produce vehicular traces and run them with a microscopic traffic simulator SUMO. Therefore, we will use all input files in XML format defined for SUMO.

1. Download OSM files from Open Street Map

You can go to OSM web site and manually download the area of your interest. We want to download a large area of Luxembourg country as shown on the picture:

However, OSM restricts the size of downloaded data by a single request. It means that to get a large map, we need to download several smaller tiles and then combine them into one. We provide a script that automises the downloading of any area.

To run the script simply type in a terminal:

python get.py --name Luxembourg --left 5.9 --right 6.44 --top 49.75 --bottom 49.513 --tiles 7

"name" is a base name for .osm files; "left", "right", "top" and "bottom" are boundaries of the requested area; "tiles" is a number of rows and columns that map will be divided to. In our tutorial we get 7x7 = 49 osm files (Luxembourg_osm.zip).

2. Convert OSM files to one NET file

We use NETCONVERT - a tool provided by SUMO to read a map representation from OSM (*.osm files) and convert it to a road network readable by SUMO (.net.xml file). Netconvert tool has many parameters that influence the conversion process

The netconvert parameters that worked for us the best are:

You can modify our script and then run it in terminal:

python build.py --netconvertPath ./netconvert --name Luxembourg --tiles 7

"netconvertPath" specifies a path to the netconvert tool; "name" is a base name for .osm files as well as for .net.xml file; "tiles" is a number of rows/columns that .osm files are devided to.

Our Luxembourg.net.xml file contains the representation of road network over the area of 51km x 44km that contains 32302 edges (47917 lanes) and 15389 junctions. The produced network file can be open with SUMO as presented below:

3. Define your own attraction areas

Create a XML file with areas that are attractive in terms of residential, commercial or industrial purpose. A part of our Luxembourg.area.xml file is presented below:

<areas residential_proba="0.33" commercial_proba="0.64" industrial_proba="0.03"> <area id="1" x="23365" y="22233" radius="1500" type="COMMERCIAL" probability="0.11" /> ... </areas>

The file should list circular areas described with their central point (x,y) and a radius. Each area has assigned a type (residential/commercial/industrial) and a probability. The sum of probabilities for every type should be less than or equal 1.

A root tag areas has attributes that specify how attractive are following types as destinations of trips. In the following example we see that the most trips will end in commercial areas (0.64).


The current version of VehiLux doesn't differentiate origins of trips. Trips start in randomly chosen residential areas, and only their destination is distributed over different types of areas according to given probabilities. This tutorial reflects the trend during morning hours, that means trips start at residential areas and finish mostly in commercial areas. More time-dependent model of probabilities distribution planned in the next versions of VehiLux that will allow to produce traces for 24-hour traffic.

4. Provide traffic volume counts

Create .loop.xml file with values of flows passing fixed counting sensors. In this tutorial we use Ponts et Chaussees traffic monitoring service in Luxembourg to obtain these values. We wrote scripts that download data from the server and generate XML file in the following format:

<loops> <loop id="1203" direction="Echternach-Luxembourg" edge="-35894685#0"> <flow cars="22" hour="1" total="22" trucks="0"/> <flow cars="13" hour="2" total="15" trucks="1"/> ... </loop> ... </loops>

Each sensor "loop" has an id and a direction (every loop counts traffic in two directions) and an assigned edge, that indicates the edge in .net.xml file.

Our Luxembourg.loop.xml file contains 15 loops and each of them gives the average number of vehicles that passed a loop at hourly intervals presented as black squares on the picture below:

These traffic volume counts are used to generate traffic flows. For example, we generate the flow of 22 cars from the loop "1203" at the first hour of simulation. In addition to these paces, we generate a ratio of trips that start in randomly chosen residential areas. The trend obtained from traffic loops reflects the realistic behaviour of traffic flows during the day, and allow to reproduce it in our model.

5. Specify vehicle types

Create a file with vehicle types that will be randomly chosen for single trips. A structure of an example Luxembourg.veh.xml is shown below:

<vTypes> <vType id="porsche" accel="2" decel="7" sigma="0.6" length="4" maxSpeed="50" minGap="2" color="1,0,0" /> ... </vTypes>

You may need a DTD file.

6. Generate traces

Get VehiLux2.0

Customise a configuration file:

<configuration> <argument name="baseFolder" value="./test/Luxembourg/" /> <argument name="baseName" value="Luxembourg" /> <argument name="stopHour" value="11" /> <argument name="insideFlowRatio" value="0.34" /> <argument name="referenceNodeId" value="77813703#1" /> </configuration>

Run java application RouteGeneration.java:

java -Xmx4096M -cp ./bin/:./lib/gs-core-1.1.1.jar:\ ./lib/gs-algo-1.1.jar:./lib/jCell.jar:./lib/jmapprojlib.jar: \ ./lib/gs-deps.jar:./lib/log4j.jar:./lib/xercesImpl.jar: \ ./lib/VectorGraphics2D-0.8.jar \ lu.uni.routegeneration.generation.RouteGeneration


Dijkstra algorithm for large graphs requires a significant memory to run.

7. Play with SUMO

You should have get your traces generated to Luxembourg.rou.xml file. See more details in traces section.

You can run SUMO simulation with your traces. Just create a sumo configuration file or download a Scenario 1 package that presets traces generated with this tutorial. An example configuration file looks like following:

<configuration> <input> <net-file value="Luxembourg.net.xml"/> <route-files value="Luxembourg.rou.xml"/> </input> <output> <no-step-log value="True"/> <summary-output value="summary.xml"/> <tripinfo-output value="tripinfo.xml"/> </output> <time><begin value="0"/> <end value="39600"/> </time> <processing> <route-steps value="200"/> <no-internal-links value="False"/> <lanechange.allow-swap value="False"/> <sloppy-insert value="False"/> <time-to-teleport value="300"/> </processing> <report> <verbose value="True"/> <no-warnings value="False"/> </report> </configuration>

VoilĂ !