Is it possible to use custom profile to allow access to otherwise restricted way?


I would like to provide a routing mode where bicycles would be allowed on roads with vehicle=no. In our country there are many roads with traffic sign restricting access to all vehicles, even they actually mean only motorized vehicles as they forget about cyclists. Is somthing like this prossible with custom_model_file ? If yes then how?


Currently every custom profile is based on a FlagEncoder (let’s say a ‘vehicle’). For every road/edge we store ‘access flags’ for every vehicle. These are simply boolean flags that determine whether a road should or should not be accessible for a certain vehicle. For example all access flags for motorways are set to false for the bike and foot vehicles. Using custom profiles you cannot change this yet, but we are working on this. So if a road is blocked for bikes you cannot simply make it accessible using a custom model without changing the GraphHopper code. In some cases you might be able to use a FlagEncoder that does not block the road you want to use in the first place, because closing roads using custom models is always possible.

Thanks for your answer. Just an idea, wouldn’t it be for such cases better to keep the restricted roads and assign them high weight (maybe even infinity)? Or would it (considerably) slow down the routing (or use more memory)?

Also, if access for bike is restricted but allowed for pedestrians, then it should be considered with weight of “pushing the bike”. I have already reported it at

Yes, there is certainly room for improvement and we are currently working on this. We are thinking about deriving the access flags from the custom profiles. So we can include/exclude arbitrary roads based on custom models.

1 Like

Is there also room to override the kissing-gate restriction for bicycles?

Here is an example where bycicles should be allowed since it is on the national node network.

This seems to be a different issue or a bug.

@ratrun do you know why we add kissing_gate as absolute barrier? graphhopper/ at master · graphhopper/graphhopper · GitHub

It would be nice if we can consider the bicycle=yes tags on these barrier nodes too:

Update: Ah, this is already discussed here: Bicycle/MTB routing should observe bicycle=yes on a barrier · Issue #407 · graphhopper/graphhopper · GitHub

Probably the same question for stile (graphhopper/ at eace9b011e3c7ce4906818d5ac7b36d98abb3dd2 · graphhopper/graphhopper · GitHub)

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