Transform districts into polygons for visualization in sumo-gui. Using the options --hue, --saturation, --brightness the colors can be controlled. Each of these options supports values from [0, 1] as well as the special value random.

python tools/districts2poly.py <net-file> <route-file>


Only districts using the attribute edges are currently supported


Parses a network and a list of polygons and writes a taz file with all the edges which are inside the respective polygonal shape. The taz-shape-files must be in the format generated by polyconvert.

python tools/edgesInDistricts.py -n <net-file> -t <taz-files>

Call option --help for additional details.


The provided taz shapes must use the same coordinate projection as the network file. The best way to ensure this when importing shapes with polyconvert is by setting option --net-file


Filter a taz (district) file using a network file and a vehicle class so that only edges which allow the given vehicle class are included in the taz definitions.

python tools/district/filterDistricts.py -n <net-file> -t <taz-file> -o <output-file> --vclass passenger

Call option --help for additional details.


Finds edges that are opposites of each other and puts them in a common district (TAZ). This can be used to improve routing in conjunction with trip attributes fromTaz and toTaz.

python tools/generateBidiDistricts.py <net-file>

Call option --help for additional details.

Example usage#

When applied to a typical OSM network, and edge and the edge with the negated id describe opposite direction edges of the same road. The generated bidi-taz would look like this:

<taz id="-123" edges="-123 123"/>
<taz id="123" edges="-123 123"/>

The <trip> definitions that would typically use attributes from and to instead use the attributes fromTaz and toTaz:

<trip id="someTrip" from="123" to="456" depart="0"/>
<trip id="someTripWithBidiTaz fromTaz="123" toTaz="456"/>

The second definition would allow departure from either edge 123' or -123 due to the way the taz 123 ** is defined. This can prevent unwanted turn-arounds and the beginning and end of generated trips and thus simplifies trips created from mapping of geo-coordinates.


Generates a grid of districts (TAZ) with a given width (in m) for a given network file.

python tools/district/gridDistricts.py -n <net-file> -o <output-file> -w 300


Segment a public transport network based on nearby stations. A station is defined by all stops (<busStop> or <trainStop>) that have the same name attribute. Each edge that belongs to the public transport network for a configurable list of vClasses is assigned to the nearest station. Each station is then written as a <taz> with it's assigned edges. By default only edges that permit vehicle classes rail or rail_urban are considered (can be set via option --vclasses) The following edges are considered part of the public transport network:

  • a) edges that have a stop
  • b) edges within a configurable radius around a station
  • c) edges that are connected to edges of category a) or b)

If there are multiple stops with different names (stations) on the same edge, the following behaviors are possible:

  • default: the edge belongs to multiple stations (<taz>)
  • option --merge: the stations are merged into a joint station with name="<NAME1>|<NAME2>"
  • option --split-output: a patch file with splits is written that allows further processing of the input network. After splitting the net and running stationDistricts.py again, each stop will have it's own edge

Example call:

python tools/district/stationDistricts.py -n <net-file> -s <stop-file> -o <output-file>