Julian Heinovski
Julian Heinovski

Reputation: 1821

How to check for an internal edge via TraCI?

I am trying to figure out whether an edge/lane is internal. When SuMO creates internal edges/lanes, it prefixes them with a colon [1]. Currently, I am exploiting this information, however, it seems that you also can annotate arbitrary other edges as internal using the tag function. This is also set for internal edges created by SuMO [1]. Therefore, I want to retrieve the information via TraCI.

To my knowledge, there is no TraCI command to retrieve this information (i.e. either the value of function or whether the edge/lane is internal). The classes MSEdge and MSLane in the microsim directory have methods to retrieve both of those values, however, the classes Edge and Lane from libsumo do not.

I also checked whether the value of the function tag might get added to the parameter map during initialization, which I could access via TraCI's getParameter. This also does not seem to be the case. I checked some files from the netimport directory but could not find anything satisfactory.

Is there any other way to retrieve the function/isInternal information via TraCI without adding a new TraCI command (and the aforementioned missing methods in libsumo)?

Upvotes: 2

Views: 510

Answers (1)

Michael
Michael

Reputation: 3680

This is a static property of the network so the easiest way of retrieving the information is to parse the network. In Python you can use sumolib for that:

import sumolib
net = sumolib.net.readNet("my.net.xml")
function = {}
for e in net.getEdges():
    function[e.getID()] = e.getFunction()

There is currently no TraCI call for that but the colon thing is a very good indicator. The main developers are also a bit reluctant to add all static information retrieval to the TraCI API in order not to overload it.

Upvotes: 3

Related Questions