Are Turn Restrictions available if not using CH?

Hello everyone,

I understood that Turn Restriction don’t work with CH. But I am not sure if they work if one is willing to not have CH (and hence have slower routing). I have read previous messages and tried to play with the code but I haven’t been able to come to a conclusion. If it is possible, how would one go about setting it up? I am not interested in UI, just in setting up a simple snippet of Java code that would do it. Something in the spirit of what is found here:

Thanks a lot,


You can create a graph with CH off and turn costs enabled via altering the properties file.

Or you can try by code:

hopper.setEncodingManager(new EncodingManager("car|turnCosts=true"));


1 Like

If Java API is used, then prefered is the pure Java API:

// 5, 5, 0 is used for no turn costs and 1 is used to say 'use 1 bit for turn costs'
hopper.setEncodingManager(new EncodingManager(new CarFlagEncoder(5, 5, 1)));

The property based constructor is likely to be replaced with a more powerful one in the near future (via a HashMap / JSON)

Thanks Peter and Emux for answering my question.

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