Generating route via a private road

I’m running locally GraphHopper, just followed the instructions and everything works great!!

The problem is I’m trying to get GraphHopper to provide the route between these two points
http://localhost:8989/maps/?point=39.802209%2C2.787781&point=39.802919%2C2.788677&profile=car&layer=OpenStreetMap&custom_model={“priority”%3A[{“if”%3A"car_access%3D%3Dfalse"%2C"multiply_by"%3A"10"}]%2C"speed"%3A[{“if”%3A"car_access%3D%3Dfalse"%2C"limit_to"%3A"1000"}]}

But it refuses to use private roads, what am I doing wrong?

Thanks!

When you set your hopper.encodedValuesString, you need to allow it to load private roads, rather than using just car_access use car_access|block_private=false

1 Like

Thank you so much for your swift response. I’m using the example config file there is in the github repo. I’ve changed this line

from

graph.encoded_values: car_access, car_average_speed, road_access

to this

graph.encoded_values: car_access|block_private=false, car_average_speed, road_access

as suggested. But I still can’t see it.

This is my custom profile:

{
  "priority": [
    {
      "if": "true",
      "multiply_by": "1"
    }
  ]
}

If I understand it correctly, this custom profile should give all ways the same priority, independently of whether they are private roads or not. What am I doing wrong?

Thanks!

After you changed the line with the graph.encoded_values did you make sure you ran a new import? You’ll have to change graph.location or delete the previous folder.

That said, the real problem here is probably that this road isn’t private but closed entirely (it is tagged as access=no) Way: 31552740 | OpenStreetMap

1 Like

Yes, I have removed the folder before re-importing the data. Is there a way to force GraphHopper to use closed roads? I’m a developer and can code in Java so I am fine changing code and building from source but the codebase is a bit alien to me now. I’m having a look at that right now but we’ll take me a while to familiarise with it.

With your configuration GraphHopper does not consider this road because of the car_access encoded value. This value is determined in CarAccess.java. To open it there is no built-in switch like the one you used to open private roads, so you have to actually modify the Java code. Keep in mind that access=no (and even an additional motorcar=no) has a rather strict meaning and allowing such roads could not be what you want in other places.