Hi Stefano,

there is an option with sumolib.net:

/net = sumolib.net.readNet("test.net.xml", withInternal=True)//
//edges = net.getEdges()//
//for edge in edges://
//    print("Edge %s is %.2fm long." % (edge.getID(), edge.getLength()))/

Regards
Mirko

Am 05.07.2018 um 17:40 schrieb Stefano Niero:

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



_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

Reply via email to