# @file runner.py # @author Jakob Erdmann # @date # @version $Id$ from __future__ import absolute_import from __future__ import print_function import os import sys sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools')) import sumolib.net net = sumolib.net.readNet(sys.argv[1], withInternal=True) lane = net.getLane("SC_0") print("connections from %s:\n%s" % (lane.getID(), '\n'.join(list(map(str, lane.getOutgoing()))))) print("outgoing internal lanes of %s: %s" % (lane.getID(), [net.getLane(c.getViaLaneID()).getID() for c in lane.getOutgoing()])) internal_edge = net.getEdge(":C_0") internal_lane = net.getLane(":C_0_0") internal_lane_cons = internal_lane.getOutgoing() print("connections from %s:\n%s" % (internal_lane.getID(), '\n'.join(map(str, internal_lane_cons)))) assert (internal_edge.getFunction() == 'internal') assert (internal_edge.isSpecial()) assert (internal_lane.getEdge().isSpecial())
from __future__ import absolute_import from __future__ import print_function import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import sumolib.net # noqa from sumolib.xml import parse # noqa if len(sys.argv) < 2: print("Usage: " + sys.argv[0] + " <NET> <STOPS>", file=sys.stderr) sys.exit() print("Reading net...") net = sumolib.net.readNet(sys.argv[1]) stops = sys.argv[2] print("Writing output...") with open('pois.add.xml', 'w') as f: f.write('<?xml version="1.0"?>\n') f.write('<additional>\n') for stop in parse(stops, 'busStop'): lane = net.getLane(stop.lane) pos = (float(stop.startPos) + float(stop.endPos)) / 2 xypos = sumolib.geomhelper.positionAtShapeOffset(lane.getShape(), pos) lon, lat = net.convertXY2LonLat(xypos[0], xypos[1]) f.write( ' <poi id="%s" type="%s" color="1,0,0" layer="100" lon="%s" lat="%s"/>\n' % (stop.id, stop.name, lon, lat)) f.write('</additional>\n')
from __future__ import print_function import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import sumolib.net # noqa from sumolib.xml import parse # noqa if len(sys.argv) < 2: print("Usage: " + sys.argv[0] + " <NET> <STOPS>", file=sys.stderr) sys.exit() print("Reading net...") net = sumolib.net.readNet(sys.argv[1]) stops = sys.argv[2] print("Writing output...") with open('pois.add.xml', 'w') as f: f.write('<?xml version="1.0"?>\n') f.write('<additional>\n') for stop in parse(stops, 'busStop'): lane = net.getLane(stop.lane) pos = (float(stop.startPos) + float(stop.endPos)) / 2 xypos = sumolib.geomhelper.positionAtShapeOffset(lane.getShape(), pos) lon, lat = net.convertXY2LonLat(xypos[0], xypos[1]) f.write(' <poi id="%s" type="%s" color="1,0,0" layer="100" lon="%s" lat="%s"/>\n' % ( stop.id, stop.name, lon, lat)) f.write('</additional>\n')
This script tests sumolib functions SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ from __future__ import absolute_import from __future__ import print_function import os import sys sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools')) import sumolib.net net = sumolib.net.readNet(sys.argv[1], withInternal=True) lane = net.getLane("SC_0") print(list(map(str, lane.getOutgoing()))) internal_edge = net.getEdge(":C_0") internal_lane = net.getLane(":C_0_0") assert internal_edge.getFunction() == 'internal' assert internal_edge.isSpecial() assert internal_lane.getEdge().isSpecial()
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ from __future__ import absolute_import from __future__ import print_function import os import sys sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools')) import sumolib.net net = sumolib.net.readNet(sys.argv[1], withInternal=True) lane = net.getLane("SC_0") print(map(str, lane.getOutgoing())) internal_edge = net.getEdge(":C_0") internal_lane = net.getLane(":C_0_0") assert internal_edge.getFunction() == 'internal' assert internal_edge.isInternal() assert internal_lane.isInternal()
#!/usr/bin/env python """ @file runner.py @author Jakob Erdmann Krajzewicz @version $Id$ This script tests sumolib functions SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ from __future__ import absolute_import from __future__ import print_function import os import sys sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools')) import sumolib.net net = sumolib.net.readNet(sys.argv[1]) lane = net.getLane("SC_0") print(map(str,lane.getOutgoing()))
#!/usr/bin/env python """ @file runner.py @author Jakob Erdmann Krajzewicz @version $Id$ This script tests sumolib functions SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ from __future__ import absolute_import from __future__ import print_function import os import sys sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools')) import sumolib.net net = sumolib.net.readNet(sys.argv[1]) lane = net.getLane("SC_0") print(map(str, lane.getOutgoing()))