Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Edge length retrieval

Dear Sumo Community,

I would like to ask how it is possible to retrieve the length of an edge through Python. Based on what I found here:

http://sumo.dlr.de/wiki/Tools/Sumolib

at the paragraph: “compute the average and median edge length in a plain xml edge file”, I wrote the following code:

for edge in sumolib.output.parse('myNet.net.xml', ['edge']):

               if edge.id == myedgeid:

                              length = edge.length

But this solution is not working as the script is able to find effectively edge.id but that, through debugging I found that edge.length is an empty veriable. I looked a little through the internet but I got a little bit confused about the answer I found. How can I retrieve the length of a particular edge?

 

Thank you very much in advance

Stefano Niero

 


Back to the top