diff --git a/features/car/weight.feature b/features/car/weight.feature index d47569d7e..64b5e891b 100644 --- a/features/car/weight.feature +++ b/features/car/weight.feature @@ -62,3 +62,28 @@ Feature: Car - weights | from | to | route | speed | weight | | a | d | ab,bc,cd,cd | 65 km/h | 44.4 | | a | e | ab,be,be | 14 km/h | 112 | + + Scenario: Distance weights + Given the profile file "car" extended with + """ + api_version = 1 + properties.weight_name = 'distance' + """ + + Given the node map + """ + a---b---c + | + d + """ + + And the ways + | nodes | + | abc | + | bd | + + When I route I should get + | waypoints | bearings | route | distance | weights | times | + | a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s | + | b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s | + | a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s | diff --git a/profiles/lib/handlers.lua b/profiles/lib/handlers.lua index 2e7daeb2c..65233ba10 100644 --- a/profiles/lib/handlers.lua +++ b/profiles/lib/handlers.lua @@ -441,7 +441,7 @@ end function Handlers.handle_weights(way,result,data,profile) if properties.weight_name == 'distance' then - result.weight = 0 + result.weight = -1 -- set weight rates to 1 for the distance weight, edge weights are distance / rate if (result.forward_mode ~= mode.inaccessible and result.forward_speed > 0) then result.forward_rate = 1