I would expect this to reduce the duration of trips by a bit less than half (I’m doubling the speeds but the turn costs are still the same) however the duration decreases less than expected:
Shorter trip: 2.7 minutes with car profile; 1.6 minutes with custom profile (59%)
Medium trip: 23 minutes with car profile; 21 minutes with custom profile (91%)
Longer trip: 129 minutes with car profile; 132 minutes with custom profile (102%)
Could you help point me in the right direction for how to get the desired result? Are there any resources or examples for how to do what I’m attempting? Any other files (or other places in the FlagEncoder file) that I should be adjusting?
For debugging it might help to enable ‘Local MVT’ from the layer menu (layer icon at the top right of your map). It should show the graphhopper route network and you can hover single streets to check if e.g. car.average_speed is what you expect it to be (you need to make the MVTResource return the path details for car.average_speed, the easiest you can do is replace the pathDetails list there with a list containing the string “car.average_speed”.
The ‘turn costs’ are only ‘turn restrictions’ (either you can do a turn or not so GH might return another route but it does not affect the travel time of a given route).
If you are doubling the speeds of all edges I would expect the durations to be exactly 50%. However, you might be running into accuracy issues when blindly doubling the speeds in defaultSpeedMap, because GH is trying to store the speeds with a minimal amount of memory (see speedBits/Factor in FlagEncoder).
@easbar Thank you very much for your answer! I’m able to view the route network and see street properties when I hover over them after enabling ‘Local MVT’. I can see:
Details:
Using the Local MVT in the web UI I was able to determine that:
The duration works as expected (takes half the time with custom Emergency Vehicle profile) on roads where max_speed: infinity
The duration does not work as expected (takes more than half the time with custom Emergency Vehicle profile) on roads where max_speed is set to a numeric value
so @karussell 's comment that, “Another factor might be because we reduce the speed according to the allowed max speed on the road.” seems to be the cause.
Any advice on how to address this? Here’s what I’ve tried:
But did you not say above that “The duration works as expected (takes half the time with custom Emergency Vehicle profile) on roads where max_speed: infinity”? You mean now the MVT view says that max_speed is infinity but the duration is still not affected?