I’m trying to create custom routes for emergency vehicles.
I create a new FlagEncoder by copying the car flag encoder https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/util/CarFlagEncoder.java and modifying the speeds like so
double emergencyCarSpeedIncrease = 2;
// autobahn
defaultSpeedMap.put("motorway", (int) emergencyCarSpeedIncrease * 100);
defaultSpeedMap.put("motorway_link", (int) emergencyCarSpeedIncrease * 70);
...
maxPossibleSpeed = (int) emergencyCarSpeedIncrease * 140;
...
( I provided some additional implementation details here: Flexible / Configurable Weighting Update)
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?
Thanks in advance for any assistance!