GraphHopper.com | Forum | GitHub | Maps | Blog

Attempting to route on a private road


#1

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: https://graphhopper.com/maps/?point=-25.768096%2C28.361681&point=-25.767303%2C28.362277

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


#2

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.


#3

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.)


#4

https://github.com/graphhopper/graphhopper/blob/master/docs/core/create-new-flagencoder.md here is a small tutorial of graphhopper. Also look into CarFlagEncoder as an example :slight_smile:

Also: https://github.com/graphhopper/graphhopper/blob/0.10/docs/core/routing.md give you a little bit of background to use graphhopper in java :slight_smile:

You can just add graphhopper to your maven dependencies in your own project and start from there.


#5

Awesome, thank you.

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

Thank you for your help.


#6

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.


#7

I am trying to follow the tutorial: https://github.com/graphhopper/graphhopper/blob/0.10.1/docs/core/low-level-api.md 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


#8

Hi,

I never used the lowlevel api. Just using the normal api with custom flagEncoders. So I can’t help you there sorry.


#9

I have now copied from here: https://github.com/graphhopper/graphhopper/blob/0.10.1/docs/core/routing.md

And checking if that works


#10

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.


#11

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?


#12

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


#13

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

I did get it right and everything is working though.


#14

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