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

Support Left-Sided Driving #2269

Closed
MoKob opened this issue Apr 15, 2016 · 17 comments · Fixed by #5849
Closed

Support Left-Sided Driving #2269

MoKob opened this issue Apr 15, 2016 · 17 comments · Fixed by #5849

Comments

@MoKob
Copy link

MoKob commented Apr 15, 2016

This requires OSRM to be country aware.

At the moment, we only support right-handed driving per default and assume it to be the general mode of driving.
This can result in broken instruction handling in left-handed driving countries.

When we get some sort of country-awareness into OSRM, we need to have a look at guidance and make sure to address left-handed driving.

@danpat
Copy link
Member

danpat commented Apr 15, 2016

@MoKob Can you list some specific examples?

@MoKob
Copy link
Author

MoKob commented Apr 15, 2016

@MoKob
Copy link
Author

MoKob commented Apr 15, 2016

In general, when I noticed it during coding, I labeled the locations with //FIXME items

@willwhite
Copy link
Contributor

In the case of the roundabout handler above, what would be broken? For example, would the guidance just say "turn right out of the traffic circle" instead of "turn left out of the traffic circle"?

@MoKob
Copy link
Author

MoKob commented Apr 19, 2016

@willwhite the count for intersections is wrong in some cases. it may say take the first instead of the second. The angles themselves are independent of the side of driving.

@MoKob MoKob self-assigned this Apr 25, 2016
@emiltin
Copy link
Contributor

emiltin commented Jul 18, 2016

related: #333

@miccolis
Copy link
Contributor

miccolis commented Oct 3, 2017

@MoKob any sense of what follow up work will remain after #4415 merges?

@MoKob
Copy link
Author

MoKob commented Oct 4, 2017

I am not aware of many situations that actually change in left-sided conditions. We already have some roundabout-handling based on profile flags. This would need to be implemented on a byCountryFlag basis, rather than on global level. The main handling works, we just need to ensure the behaviour is adjusted based on countries, so we can have a single graph with both left/right handed driving.

Turn lane handling for roundabouts assumes right-sided driving. We currently have them disabled anyhow, though. When we redo them to work at all, we should take left-sided driving into account.
Other cases might be optimised for right-hand detection. The code requires a general overhaul though, which could be best done, after we have maneuvers in extraction, since lane handling on OSRMs data model is a game of chance right now.

With this flag, we would also be able to switch to a TurnType::UTurn and DirectionModifier::Left\Right. The main issue here is, that this would constitute a breaking API change, since it cannot be interpreted as a normal turn. A former uturn might suddenly be announced as a Turn Left.

@daniel-j-h
Copy link
Member

Lane Anticipation:

else // FIXME: right-sided driving

and I came across a few comments sprinkled throughout the code base a while ago

// FIXME if we have a left-sided country, we need to switch this off and enable it
// below

// FIXME the lane to add depends on the side of driving/u-turn rules in the country

@cmhh
Copy link

cmhh commented Jan 12, 2018

This is a massive issue for left-side driving countries (of which there are a lot!). I'm trying to use the trip service to solve the TSP, and the results are unusable--the sorted order of the waypoints is essentially in the reverse order from what would be correct in most cases. I have set approach to curb for all waypoints, but the result has them all visited on the right-hand side of the road. I could be missing something, of course?...

Perhaps approach could take left, right, or unrestricted; rather than curb, or unrestricted?

@danpat
Copy link
Member

danpat commented Jan 12, 2018

@cmhh OSRM now has basic support driving side. The demoserver calculates driving side during pre-processing and returns it with routing results.

If you're running your own OSRM server, you'll need to add the --location-dependent-data data/driving_side.geojson flag to osrm-extract so that it performs the lookup for each road.

As noted above, there are probably still some corner cases around guidance, but the approach=curb property should work.

If you're seeing a specific problem, please open a new ticket with a recipe to reproduce the data you're using, a sample query, the results you're seeing, and the results you expect.

@cmhh
Copy link

cmhh commented Jan 12, 2018

Great! I was looking down the barrel at doing this with ArcMap's Network Analyst (yuck), or implementing something bespoke myself. I made a Docker image with this flag set and it seems to be working pretty well.

Thanks heaps.

@ghoshkaj ghoshkaj assigned ghoshkaj and unassigned ghoshkaj Jan 22, 2018
@murphy-paul
Copy link

murphy-paul commented Oct 1, 2020

I've been trying to enable the above mention support for driving side on our OSRM service using the location-dependent-data but the response is still returned with driving_size = right. I've also tried this on the OSRM demo server and the result is the same. For coordinates in Ireland the driving side should be left

curl --location --request GET 'http://router.project-osrm.org/trip/v1/driving/-7.700471878051758,52.35865823116153;-7.700697183609009,52.3519350813739?overview=full&steps=true&roundtrip=false&source=first&destination=last'

I'm using docker to process the osrm files and run the routing engine. Commands I use are below. II'm using the latest docker builder (image id: d45a54a4bc52)

docker run --rm -t -v "${PWD}/data:/data" osrm/osrm-backend osrm-extract --location-dependent-data "/data/driving_side.geojson" -p "/opt/car.lua" "/data/britain-and-ireland-latest.osm.pbf"
docker run --rm -t -v "${PWD}/data:/data" osrm/osrm-backend osrm-partition "/data/britain-and-ireland-latest.osrm"
docker run --rm -t -v "${PWD}/data:/data" osrm/osrm-backend osrm-customize "/data/britain-and-ireland-latest.osrm"
docker run -t -i -p 5000:5000 -v "${PWD}/data:/data" --name osrm_test osrm/osrm-backend osrm-routed --max-trip-size 1000 --algorithm mld "/data/britain-and-ireland-latest.osrm"

The only way I could get driving_side to be left is to change the left_hand_driving of the profile to be true.

Any help would be greatly appreciated.

@danpat
Copy link
Member

danpat commented Oct 1, 2020

Looks like driving_side.geojson as messed up in commit 3c607a4 - there should be "properties": { "driving_side": "left" }, on each feature in that .geojson file.

Try adding "driving_side": "left" to the properties of each geojson feature in that file and see if it fixes your problem.

@murphy-paul
Copy link

That's it. That fixed the problem for me. Thanks again for the super fast response @danpat .

@danpat
Copy link
Member

danpat commented Oct 1, 2020

If you have time, a PR fixing the file in the repo would be appreciated!

@murphy-paul
Copy link

I don't have permissions is to push a branch. Do I need to do this on a fork @danpat ?

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

Successfully merging a pull request may close this issue.

10 participants