Tools/Sumolib

generated on 2013-11-27 00:42:13.599589 from the wiki page for Tools/Sumolib for SUMO 0.19.0

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>/tools 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 4 September 2013, at 14:16.