osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

car profile use lane_markings=no as indicator for narrow street

Open flohoff opened this issue 1 year ago • 3 comments

Hi, i use OSRM for Routing quality assurance in a part of Germany since 2013. I typically find unwanted Rat Race roads and changes in routing over time done by accident e.g. broken turn restrictions, deleted segments etc.

I typically tune the relative weight between roads by tagging maxspeed and lanes. E.g. the smaller rural roads get lane count 1 if they are to narrow for overtaking.

In the end this is not a 100% correct as most of the time there are no lane markings so noone could actualy count the lanes. Still they are narrow.

The OSRM car profile uses the lane count to reduce the assumed speed by half based on maxspeed or road type.

I would suggest doing something similiar when looking at the tag/value lane_markings=no

I'd like to reduce the speed not to 0.5 but something like 0.75 - just a smaller penalty.

Something like this. Just tested on real live data with ~50k routes and compared them with their originals and this looks pretty promising. Of 50K routes ~400 have changed. Most of them to the better e.g. avoiding small narrow roads for through traffic.

diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua
index b13410235..5c3528d5d 100644
--- a/profiles/lib/way_handlers.lua
+++ b/profiles/lib/way_handlers.lua
@@ -397,6 +397,11 @@ function WayHandlers.penalties(profile,way,result,data)
   local is_bidirectional = result.forward_mode ~= mode.inaccessible and
                            result.backward_mode ~= mode.inaccessible
 
+  local lanemarkings = way:get_value_by_key("lane_markings")
+  if (lanemarkings and lanemarkings == 'no' and is_bidirectional) then
+    width_penalty = 0.75
+  end
+
   if width <= 3 or (lanes <= 1 and is_bidirectional) then
     width_penalty = 0.5
   end

Flo

flohoff avatar Oct 11 '23 11:10 flohoff

Just a usage update. I am running this since Oct 10th in my RouteQA and it produces better routes. As StreetComplete also tags lane_markings=no if user answers with "there are no lanes" this will be a fast growing road tag in use.

flohoff avatar Dec 11 '23 10:12 flohoff

Are you specifically referring to the borderline cases as in the last table row below ? These roads have typically a width between 3 and 4 meters, and no lane markings.

Screen Shot 2567-04-03 at 10 57 41

If so, the condition should

  • come below the other conditions for narrower ways
  • make sure that lanes tag is not specified (lanes>=2 + lane_markings=no is not narrow, lanes=1 + lanes_markings=no would refer to the other condition)

cmoffroad avatar Apr 03 '24 04:04 cmoffroad

Yes - sometimes the road isnt that narrow but still its not as wide as its possible to really put 2 seperate lanes on it. Thats easy to detect from aerials which "width" is not.

In my experience missing lane markings is an indicator of a smaller or less controlled/ordered traffic flow which makes it slower. Not as radical as a definite one lane road, but a little slower.

Flo

flohoff avatar Apr 03 '24 07:04 flohoff