/route-custom heading not working

Hi :smile:!

I’ve been experimenting with GraphHopper open source routing engine for my thesis 6 months ago. I used the /change endpoint a lot, which has been removed in the latest update. Now, after 6 months, I retuned to my old thesis project to experiment some more with it. I found out that there is a new endpoint, the /route-custom endpoint. I read the documentation about it https://www.graphhopper.com/blog/2020/05/31/examples-for-customizable-routing/ , but I got two questions:

  1. Does the “heading” parameter work when algorithm=round_trip? If I make a POST request to /route-custom with 2 different headings, it gives me the same round trip back. I would really like to know if I am doing something wrong here… because I really need the heading :smile:.

This is my config.yml:

This is my API call with first heading value:

This is my API call with different heading value:

  1. I want to use the curvature weighting to give me round trips with curvy roads. But at the same time I want to filter some options out with the /route-custom, for example avoiding toll or ferry depending per request. How can I combine these two functionalities? I have noticed that if I want to use the /route-custom endpoint, weighting must be ‘custom’.

Looking forward to your replies :muscle:!

Greetings,
Kitcat

  1. Did you try a few other points? The heading is not strictly enforced so there might be cases where you get the same route even for different values of the heading. Do you have an example where heading works with e.g. fastest weighting but not with custom weighting? And yes heading should affect the result for round trip as well.

  2. There is no support for customized curvature weighting currently, but it should be possible to use the curvature and/or priority encoded values with custom weighting (I never tried though).

2 Likes
  1. Yes I tried with a lot of different points + headings, but still no difference in round trips when using different headings. Before I used the /route endpoint to create the round trips and the heading worked very well with this endpoint. I am experiencing this problem only with the /route-custom endpoint…

Example call where heading works (/route)

localhost:8989/route?point=51.78294893675145,4.593615531921388&points_encoded=false&vehicle=motorcycle&ch_disabled=true&.heading=100&algorithm=round_trip&round_trip.distance=50000&round_trip.seed=17&instructions=false

  1. I have never tried that either… but I will look into it. Thanks for the tip :smile:

For the latest stable version the motorcycle values should be accessible via:

motorcycle.priority or motorcycle.curvature

E.g.

priority:
  motorcycle.curvature:
     "> 0.5": 0.5

This will change with 3.0 (along many other changes to the custom routing) and this will be:

motorcycle$priority or motorcycle$curvature

2 Likes

Ah thats amazing, thanks! Will try it out :smile:.

Any idea what I am doing wrong with the ‘heading’ paramter in the POST call?

Are you using client-hc (the hand crafted Java client)? It could be this: https://github.com/graphhopper/graphhopper/issues/2009 and if not it might be because the parameter is called headings (not heading) for POST

1 Like

I cloned the repository https://github.com/graphhopper/graphhopper, if that is the client-hc, than yes. Any progress on this bug yet :face_with_monocle:?

I also tried it with “headings” instead of “heading”, which gave me the following error:

Try "headings": "[150]". Yes I meant the client-hc module in the graphhopper repository.

2 Likes

omg !! This is the solution. Thanks!! :grin:

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