-
Notifications
You must be signed in to change notification settings - Fork 13
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
accept discouraged access tags for foot/bicycle routing #950
base: main
Are you sure you want to change the base?
accept discouraged access tags for foot/bicycle routing #950
Conversation
discouraged is used to say it is permitted, but could be dangerous, we should accept routing with this tag
Is there a way to give a penalty when using this tag? |
Can you add a link to the tag documentation in the commit message or in the file? |
With OSRM actual version: short answer: no |
Links added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dommage qu'on ne puisse pas mettre de pénalité... Est-ce que ça ne risque pas de faussement donner des "points" au vélo ou à la marche dans nos calculs comparés par mode en faisant marcher/rouler les gens sur des boulevards urbains plein de camions, mais plus directs? Mais si ça encourage à y faire des REV, ce serait pas trop mal...
Limite de OSRM... Il faut utiliser Valhalla pour de meilleurs résultats pondérés selon nos critères |
@kaligrafy il me semble que c'est possible d'ajuster le rate dans les profils Lua selon les tags OSM. Voir cet exemple: Project-OSRM/osrm-backend#4711 |
@davidmurray oui c'est exact, mais juste sur le tag highway... Là on est dans le tag foot ou bicycle, qui n'est pas accessible sauf pour les blacklists et whitelists (à ma connaissance), libre à vous de voir si on peut magouiller le profil pour avoir ça |
Oui, c'est possible avec la fonction Voici un exemple (untested!) function safety_handler(profile, way, result, data)
-- convert duration into cyclability
if profile.properties.weight_name == 'cyclability' then
local safety_penalty = profile.unsafe_highway_list[data.highway] or 1.
local is_unsafe = safety_penalty < 1
-- primaries that are one ways are probably huge primaries where the lanes need to be separated
if is_unsafe and data.highway == 'primary' and not data.is_twoway then
safety_penalty = safety_penalty * 0.5
end
if is_unsafe and data.highway == 'secondary' and not data.is_twoway then
safety_penalty = safety_penalty * 0.6
end
local forward_is_unsafe = is_unsafe and not data.has_cycleway_forward
local backward_is_unsafe = is_unsafe and not data.has_cycleway_backward
local is_undesireable = data.highway == "service" and profile.service_penalties[data.service]
local forward_penalty = 1.
local backward_penalty = 1.
if forward_is_unsafe then
forward_penalty = math.min(forward_penalty, safety_penalty)
end
if backward_is_unsafe then
backward_penalty = math.min(backward_penalty, safety_penalty)
end
if is_undesireable then
forward_penalty = math.min(forward_penalty, profile.service_penalties[data.service])
backward_penalty = math.min(backward_penalty, profile.service_penalties[data.service])
end
+ -- Add penalty for bicycle=discouraged tag
+ local bicycle_tag = way:get_value_by_key("bicycle")
+ if bicycle_tag == "discouraged" then
+ forward_penalty = forward_penalty * 0.5
+ backward_penalty = backward_penalty * 0.5
+ end
if result.forward_speed > 0 then
-- convert from km/h to m/s
result.forward_rate = result.forward_speed / 3.6 * forward_penalty
end
if result.backward_speed > 0 then
-- convert from km/h to m/s
result.backward_rate = result.backward_speed / 3.6 * backward_penalty
end
if result.duration > 0 then
result.weight = result.duration / forward_penalty
end
end
end
|
On peut créer un nouveau issue séparé pour ça? |
discouraged is used to say it is permitted, but could be dangerous, we should accept routing with this tag