Tools/Sumolib

From Sumo

sumolib is a set of python modules for working with sumo networks, simulation output and other simulation artefacts. For a detailed list of available functions see the pydoc generated documentation. You can [browse the code here].


importing sumolib in a script

To use the library, the <SUMO_HOME> directory must be on the python load path. This is typically done with a stanza like this:

 import os, sys
 if 'SUMO_HOME' in os.environ:
     tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
     sys.path.append(tools)
 else:   
     sys.exit("please declare environment variable 'SUMO_HOME'")

usage example

 import sumolib
 net = sumolib.net.readNet('myNet.net.xml')
 print net.getNode('myNodeID').getCoord()

This page was last modified on 23 August 2013, at 12:30.