[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [sumo-user] Measuring Distances
|
I reran the net.getShortestPath(..., ignoreDirection=True), and it worked fine this time. I mistakenly must have made a typo.
However, the distance seems to make little sense. For example, in the network used (attached), while calculating the distance between edges 67 (length= 88.54) and 72 (length = 92.80), the distance should be 88.54+92.8=181.34. However, the distance obtained by code is 266.94. Similar behaviour is seen in other edges as well. Kindly check and suggest where I am making a mistake.
The code used, and the network files are attached.
Also, is there a way to visualise these distances? I would use route mode in Netedit to find the shortest distance. But since we want ignoreDirection=True here, that workaround does not work.
SUMO supports net.getShortestPath(..., ignoreDirection=True) since version 1.11.0 (
Unless you have a very old version it should work. Please quote the exact code line you are using and the exact error message.
For the TraCI solution, it is enough to have the simulation load the network (which is about as fast as loading it with sumolib).
Apologies for the late response.
As I mentioned, I wish to compute the walking distance from parking spaces to the destination polygon. This is a one-time calculation and does not/should not require me to run the simulation. Therefore, I was not willing to use TraCI. For the tweaks you suggested, I am not sure if the traci.simulation.findIntermodalRoute will require me to run the simulation or not. Secondly, I tried getShortestPath for sumolib, but it says that getShortestPath has no attribute ignoreDirection.
Could you please provide me with a few more details on how to implement these tweaks?
Thanks a lot.
For pedestrians, there are some tweaks:
1. use traci.simulation.findIntermodalRoute
2. call getShortestPath(..., ignoreDirection=True)
3. encode your query as a person/walk instead of a trip
I tried adding pedestrian sidewalks, but they also follow lane directions and hence have the same issues. I also thought to convert the lanes to bi-directional nut given I have a large network, I could not find an easier way to do so.
Thank you for getting back to me.
What I am trying to compute is walking distance from parking spaces to the destination polygon. One solution I could think of was to obtain coordinates (manually using Netedit) for parking spaces and destinations and compute the distance. They would, however, give Euclidean distance. Based on what you recommended,
I used Solution 2, which gave me the shortest distance between the "fromNode" of one edge and the "toNode" of another edge. This works for most of the edges. However, the edges adjacent to the destinations use the road network to compute the shortest path. However, as I am trying to calculate the walking distance from parking spaces to the destination polygon, the pedestrian should cross over the lanes and directly reach the destination across the edge.
Is there a way to overcome this problem?
Any help is appreciated.
Thanks and regards,
Solution 1: using TraCI
- traci.simulation.getDistanceRoad
Solution 2: using sumolib:
- sumolib.net.getShortestPath / getFastestPath
Solution 3: using duarouter:
- encode the distance you want to measure as trips (edges and coordinates are supported)
- set the trip to a vType with maxSpeed=1
- read the results from the .rou.alt.xml output file (costs equal distance in m)
Dear community,
I have a few destinations in my road network. Some destinations are created as polygons alongside edges, while others are marked on the road edges. I plan on calculating the distance (by road) between these destinations. I could calculate them using the coordinates, but that would give Euclidean distance, not the distance on the road. Since there are multiple destinations, I am not willing to manually do this.
Is there a way to compute these distances? I would greatly appreciate any help.
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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
Attachment:
attachments.zip
Description: Zip compressed data