How to enable car routing for military areas?

I see CarFlagEncoder has restrictions for residential, military and private roads.

    public CarFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts) {
        super(speedBits, speedFactor, maxTurnCosts);
        restrictions.addAll(Arrays.asList("motorcar", "motor_vehicle", "vehicle", "access"));
        restrictedValues.add("private");
        restrictedValues.add("agricultural");
        restrictedValues.add("forestry");
        restrictedValues.add("no");
        restrictedValues.add("restricted");
        restrictedValues.add("delivery");
        restrictedValues.add("military");
        restrictedValues.add("emergency");

How can I allow car route in military and residential road using config.yml?

1 Like

This is currently only possible via the Java source code. But the opposite is possible (further limiting an existing FlagEncoder) via the new customizable routing feature:

How do you suggest by code. Do I have to create new FlagEncoder or is there some other way to grant access to car in case of military and private roads?

I would probably just extend the FlagEncoder, yes. And then maybe call

restrictedValues.remove("military");
// or
restrictedValues.clear();
restrictedValues.add...

?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.