Attempting to route on a private road

I am currently trying to create a routing map which will allow routing on any road regardless of it’s access rights.

But it seems I am unable to do this.

I have tried changing all access modifiers in the OSM data to have all roads be public access, and I have tried changing all barriers by either deleting them or by changing them to traffic_signals, hoping that that might allow me to route past the barrier. But nothing I have tried seems to work.

An example of a route which fails:

When using my own local instance I get the error: “Connection between locations not found”

You could create your own flagencoder and override the acceptWay(ReaderWay way) to return always the acceptBit. That should accept all roads.

Also look into handleNodeTags(ReaderNode node) in AbstractFlagEncoder. Removing all barriers and potentialBarriers could do the trick or override the function to always return your desired value.

I assume then that I would need to import the project and create this new Encoder? I am currently just using the graphhopper-web-0.10.1-with-dep.jar file directly from Maven.

Are there any examples that I could perhaps reference on how to do this? (The creating my own encoder that is.)

Awesome, thank you.

I will look into those, and respond here if I am successful or not.

Thank you for your help.

1 Like

You are welcome :slight_smile: I also don’t know if it will 100% work, but it was my guess :slight_smile:

Just post here, if you have any problem.

I am trying to follow the tutorial: to use the library directly, but this line throws an error on this line:

Path path = new Dijkstra(queryGraph, encoder).calcPath(fromQR.getClosestNode(), toQR.getClosestNode());

With an invalid use of new Dijkstra

I have now copied from here:

And checking if that works

I have managed to get it right by disabling the restricted ways and barriers, and now I can route on that route.

Thank you so much for your help.

Now the next thing is to get that encoder into the web client. Would I need to recompile the web client to support the new encoder?

What web client are you referring to? In general the web client should allow you to set any vehicle as a string.

I was referring to the web client that is built into your source code. The one that gets run if you run ./ web

I did get it right and everything is working though.

1 Like

I did manage to get everything working now. Thanks for your help.