utack / utack_brouter_profile

A BRouter profile for some light touring or commuting with a city bike
13 stars 2 forks source link

Add switch to not use offroad #32

Open Wizit38 opened 2 years ago

Wizit38 commented 2 years ago

Is it possible to add a switch to use only paved roads and cycleways?

Sometimes on a tour you are really tired or you are not confident of riding offroad. It would be nice to have a switch to force the route not to be offroad under these times.

Best Regards

utack commented 2 years ago

Hi,

thanks for your idea. I will have to think about it a bit before finding a good solution

For now can you test if this works for you https://pastebin.com/pYsz3JQH

Please find a new parameter "smoothness_limit" in line 38 that you can play with for a bit, something like 0.4 as I have applied now should quite strictly only give you roads in excellent conditions Something like 0.8 should probably also still be ok in slightly "tired" conditions, but would allow some unpaved roads

Wizit38 commented 2 years ago

thank you so much. I will try it later.

Wizit38 commented 2 years ago

The value worked nicely on the route I tested on. It originally routed on a dirt track but now routes along paved roads. Thank you for this

Wizit38 commented 2 years ago

Btw, I found that 1.25 seems to be the threshold to switch back to the original profile

Wizit38 commented 2 years ago

Based on this, I implemented the following:

switch to use paved roads only

assign paved_routes_only false

the maximum smoothness penalty a way may have before we avoid it

assign smoothness_limit = switch ( paved_routes_only ) 0.4 1.25 # Set to 0.4 to use paved roads, >1.25 to allow dirt tracks

Sorry about the bold text. Seems it bolds text after #