A dangerous and unreliable routing result

Hi,I have a confusion about the findClosest.It seems only influence by distance.
If a primary way is closer than a foot way,the closest way will choice the primary way. It is unreasonable when vehicle is foot.
There is one example:


Seems to be obeying right of way restrictions

There are tags contain highway = trunk whose name is 猎德大道. It should be avoid for foot.

And other important thing is that the routing to detour and cost more time.

It costs more time but obeys lane directions. Check Openstreetmap for footpath/walking allowances.
I’ve never routed for walking, unsure if highways are pre-built for avoidance, I suspect not if this is occurring.

Thank you for your reply.
I had read some java codes of the graphhopper engine and found that it would find the closest way (node) of the start and end points firstly. It seems to create two problems:

  1. to get the closest way (node) have not consider way(node) restrictions.
  2. use the closest way(node) even if it will be to detour that means not the best route.

to get the closest way (node) have not consider way(node) restrictions.

We currently allow trunk for foot as it is allowed in some countries to walk there, still we try to avoid routing over trunk .

There is work for country-specific rules: https://github.com/graphhopper/graphhopper/pull/1799

Probably what you are after is map matching? https://github.com/graphhopper/map-matching

Can u use the following?

avoid string

Specify which road classes and environments you would like to avoid. Possible values are motorway , primary , secondary , tertiary , trunk , residential , steps , living_street , track , toll , ferry , tunnel , bridge and ford . Separate several values with ; . Obviously not all the values make sense for all vehicle profiles e.g. bike is already forbidden on a motorway . Requires ch.disable=true .


Please note two things:

  1. this topic is about the routing engine and the docs you linked are from the Routing API where we use the routing engine but it is not 1:1 (although we are working on it and release commercial features of it as open source but want to implement them in a clean way). The web API documentation of the routing engine is at github and there is no avoid feature, still you can easily implement it (and we’ll make this happen soonish via a different and more powerful feature, see issue 1776)
  2. the avoid parameter of the Routing API currently does not work for the first location. See issue 729 which will be fixed before issue 1776

All right,I would understand countries have specific rule.
But as the example above,the first routing costs more time than the second.I confused the fastest weighting.It seems only consider the start point close to the way and may regardless of other paths.
Would we consider the second route path as one candidate result in the first case?

It may be a solution about restrictions through not be implemented yet.