Using Country Rules


I’ve just seen the announcement about V4 and the new Country Rules. This sounds great, thanks for this latest release. We’ve previously had to modify the OSM file prior to generating the graph from the .jar file to allow walking and cycling on all UK bridleways by default, as GH didn’t always allow access if there wasn’t an explicit access tag. It sounds like we may not need to do this now. Sorry to be a bit dim though, but do you have a worked example of how to use the country rules, as I’m not clear how they work? It says in the new config file that it “applies country-specific routing rules (enabled by default) during import” but where are these country specific rules and how do you set them up? Thanks.

This was an error in the documentation. The country rules are not enabled by default. We fixed the documentation after the 4.0 release here:

So far GraphHopper only ships with country rules for Germany and Austria. See for example:

Also, so far they only work for TransportationMode.CAR, so you probably want to keep your current modifications. But hopefully the country rules will become more powerful soon.

Thanks for clarifying that. We’ll keep an eye out for future updates.

There is an open PR supporting country specific path handling:

Powered by Discourse