Hi,
I want to reduce the speed for certain road types. My approach is to write my own CarFlagEncoder
and overwrite the speed values in the defaultSpeedMap
. My custom FlagEncoder looks like this:
public class Car30FlagEncoder extends CarFlagEncoder {
public Car30FlagEncoder() {
super();
defaultSpeedMap.put("primary", 30);
defaultSpeedMap.put("primary_link", 30);
defaultSpeedMap.put("secondary", 30);
defaultSpeedMap.put("secondary_link", 30);
defaultSpeedMap.put("tertiary", 30);
defaultSpeedMap.put("tertiary_link", 30);
}
public String toString() {
return "car30";
}
However, overwriting the defaultSpeedMap
does not have any effect. If I do a routing (along a primary
road) once with the standard CarFlagEncoder
and once with my Car30FlagEncoder
both routes exhibit exactly the same travel time. What am I missing? The road has the OSM tag maxspeed
(with a value >30 km/h) set. Does maxspeed
overwrite the values from defaultSpeedMap
?
I am using
- version 2.3
- contraction hierarchies
- weighting
fastest
ASTAR_BI
Best, Johannes