Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Convert trips to list of nodes 15)
  • From: eclipse.eprok@xxxxxxxxxxxxxxx
  • Date: Tue, 14 Jul 2020 16:12:15 +0200
  • Autocrypt: addr=eclipse.eprok@xxxxxxxxxxxxxxx; keydata= mQINBFgZDvkBEADGl5kubXVMj1BvkQIc0gkrg6Bxd2p1sHK/zzfgNQ8oKQoUcXlcyZOcd0PL QGO7cHBKnGchSWP2SlBIZxyUP86ekSvfevNe6tSyIBpbm+YoqyOWNB8gO83CQTTUFAdlZQVb d6aLCqSuF34m2H6wMIX0+QoE1mGbW5NGSVuruGvcZs9aeJvf1P9t6jtWoN/TWVT3dSyp81r6 zl5RA5Wy/LH4RJYEWlbHyJvp4o9digA5vxlrrnERfAKNf2U0/RB/NEegrt/xuWoQwbFHVTxg i2zgPuO6obHxy8Ith3nfvWEhb44NLM92JcmBNDDtZJd/hKy7RuWJgBOT9ZhqwGHqDGBijfyu eB9OjCwI3ZeuY0knbycu9eJoKih9be2H+00oCeWSwWS79fp4WPCNlz1L9GAyShMidXBD8VrS iBdRwJ8glYgnfnWhi78BkqghUTqfjCqEoCt5pKX4XXOF1+8TDW6a8iKWTmehAUbXI1uVcnNR +yySa23QXzJRCU5qeyoYFqArHA0tanA6KUgdDwzT5qoypjS3PtpJBWprpR5DVV6a45A8e3D2 7sBVaUDgW5USX+Y+QgUx+Fz1nupgz2eBTGp7viiMrA+YgaNtjSBKsPirIsZpaar9LFts1R2S nbr+qkda8/GkufZtPvxbFvaSjneBU8h3vqQWG4u0zwkV623pVwARAQABtCJBbnRvaW5lIEh1 Y2hldCA8YW50b2luZUBodWNoZXQubWU+iQJXBBMBCABBAhsjBQkJZgGABQsJCAcCBhUICQoL AgQWAgMBAh4BAheAFiEEkRvq9+B+JsyFHOGPZeoSlSt/V6sFAliKA/0CGQEACgkQZeoSlSt/ V6tgoQ/+JinmnhbftNQfTpvS9JsHLD6fTl3J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xxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/sumo-user>
  • List-help: <mailto:sumo-user-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=unsubscribe>
  • User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.10.0

Hi Giuliana,

Thank you very much, this is exactly what I needed.

I could work out my problem :).

Have a good day,
Antoine

Le 09/07/2020 à 19:17, Maria.Armellini@xxxxxx a écrit :
> Hi Antoine,
> 
> The "edges" attribute in the route file shows the consecutive edges id of the route.
> <route edges="35049297 -173282740 150031197#8" /> This route is composed of three edges with ids 35049297, -173282740 and 150031197#8.
> 
> Regarding your first question, you can use sumolib in python to parse the network and the route file. See https://sumo.dlr.de/docs/Tools/Sumolib.html for some examples.  
> You could for example read all edges ids in each route and use the "from node" attribute to get the node id. For a list of all node ids in the network, you can use getNodes(). This can be done with the following Python code:
> 
> 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'")
> 
> # import the library
> import sumolib
> 
> # parse the net
> net = sumolib.net.readNet('myNet.net.xml')
> 
> # parse all nodes in the net
> node_ids = [node.getID() for node in net.getNodes()]
> 
> # parse all edges in the route file
> for route in sumolib.output.parse_fast('myRoutes.rou.xml', 'route', ['edges']):
>     route_edges = route.edges.split()
>     
>    # get node ids instead of edge ids
>     route_nodes = [net.getEdge(edge).getFromNode().getID() for edge in route_edges]
>     # do something with the vector of node ids
> 
> 
> Regards,
> Giuliana
> 
> -----Original Message-----
> From: sumo-user-bounces@xxxxxxxxxxx [mailto:sumo-user-bounces@xxxxxxxxxxx] On Behalf Of eclipse.eprok@xxxxxxxxxxxxxxx
> Sent: Donnerstag, 9. Juli 2020 17:33
> To: sumo-user@xxxxxxxxxxx
> Subject: [sumo-user] Convert trips to list of nodes
> 
> Hello,
> 
> I am working on graph algorithms. I use python and networkx.
> I would like to work with the data from the TAPAS Cologne scenario
> (https://sumo.dlr.de/docs/Data/Scenarios/TAPASCologne.html).
> 
> I would like to have the graph corresponding to the road network in the
> format: "node1 node2", along with a list of nodes for each trajectory.
> 
> How could I do that?
> 
> I successfully converted the road network to a format that networkx
> understands but the tool that I used renamed the nodes, so I can't use it.
> 
> As for the trajectories, I have a .rou.xml file with <route
> edges="35049297 -173282740 150031197#8" />. What is between quotes? Is
> it the list of nodes of the trajectory?
> 
> Thanks for your help,
> Antoine
> 
> _______________________________________________
> sumo-user mailing list
> sumo-user@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
> _______________________________________________
> sumo-user mailing list
> sumo-user@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
> 



Back to the top