utack / utack_brouter_profile

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

factor brouter pseudo traffic into traffic penalty #26

Open utack opened 4 years ago

utack commented 4 years ago

factor in the pseudo traffic tags from brouter for traffic penalty

Wizit38 commented 2 years ago

While waiting for this add, I modified the profile slightly to better handle the traffic situation.

I increased the number of traffic_tier from 4 to 6,

The code segments are as follows: assign traffic_tier1 0.1 # pedestrian paths assign traffic_tier2 0.2 # residential roads assign traffic_tier3 0.4 # Tertiary roads assign traffic_tier4 0.5 # Secondary roads assign traffic_tier5 1.0 # Primary roads assign traffic_tier6 3.0 # Trunk roads /motorways

assign traffic_cost

many pedestrians but no cars expected

if or and highway=pedestrian ( not segregated=yes )
    ( highway=platform|corridor )
    then traffic_tier1
# anything without motor vehicles is fine
else if not any_motoraccess then 0.0
else if low_traffic then 0.0
# 3+ lanes = lots of expected traffic
else if and ( and oneway=yes|true|1|-1 lanes=3|4|5|6|7 ) ( not hascycleway ) then traffic_tier5
else if and lanes=5|6|7  ( not hascycleway ) then traffic_tier5
# no one likes HGVs (Heavy Goods Vehicle)
else if hgv=designated then traffic_tier5
# wild traffic guesses based on roadtype only
else if not hascycleway then
    if highway=motorway|motorway_link|trunk|trunk_link then traffic_tier6
    else if highway=primary|primary_link then traffic_tier5
    else if highway=secondary|secondary_link then traffic_tier4
    else if highway=tertiary|tertiary_link then traffic_tier3
    else if highway=residential|mini_roundabout|road|unclassified then traffic_tier2
    else 0.0
else if hascycleway then
    if highway=motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link then traffic_tier2
    else if highway=tertiary|tertiary_link then traffic_tier1
    else 0.0
else 0.0

(By the way, I also increased initialcost_waypreference from 100 to 140 (the route was turning into a tertiary road and then turning back to the same secondary road after a few hundred meters. See cheng san community club to tuas lamp post 1 along tuas south ave 5).