Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about getting the lane ids of an edge. #14893

Closed
RaffaeleTranfaglia opened this issue May 20, 2024 · 4 comments
Closed

Question about getting the lane ids of an edge. #14893

RaffaeleTranfaglia opened this issue May 20, 2024 · 4 comments

Comments

@RaffaeleTranfaglia
Copy link

Is there a way to get the lane ids composing an edge from a given edge id?
e.g. something like traci.edge.getLanesID()

In general I need a way to iterate over the lanes of a given edge.

SUMO version: 1.20.0

@m-kro
Copy link
Contributor

m-kro commented May 20, 2024

You can use sumolib to query static network information. Please look at how to load a network with sumolib. Then you can access sumolib.net.edge.getLanes() to get the lanes belonging to a certain edge.

@namdre
Copy link
Contributor

namdre commented May 21, 2024

laneIDs = ["%s_%s" (edgeID, i) for i in range(traci.edge.getLaneNumber(edgeID)]

@namdre namdre closed this as completed May 21, 2024
@RaffaeleTranfaglia
Copy link
Author

You can use sumolib to query static network information. Please look at how to load a network with sumolib. Then you can access sumolib.net.edge.getLanes() to get the lanes belonging to a certain edge.

Thank you, it worked.

laneIDs = ["%s_%s" (edgeID, i) for i in range(traci.edge.getLaneNumber(edgeID)]

I have thought about this, but I am not sure that the lane id always follows the format <edgeID_number>.

@namdre
Copy link
Contributor

namdre commented May 21, 2024

Be asured that lanes always follow this naming scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants