Motocycle and Scooter could not snap to Way

Hello. I got a trouble in GH , that’s my route can’t snap and route to this way (Way: ‪National Route 1‬ (‪1348149579‬) | OpenStreetMap) ?
From point : 20.98144585243455,105.89110672473909
To point. : 20.984333,105.893616
profile : scooter
I try to add access and motorcycle :yes but It’s not work :cry:

Your ‘To point’ is located on a bridge, but GraphHopper prevents snapping to bridges by default: Snap preventions default by karussell · Pull Request #3075 · graphhopper/graphhopper · GitHub

@easbar yes, I know that. I tried to disable this rule on my local but it’s not work. So, You can check with “to point” 21.000555,105.918002 . I changed "To point " and check but I don’t understand why my route is like that. It’s should be route via way 1348149579 …

The reason the trunk along the bridge is not accessible for scooters is that the trunk (only) leads into a motorway (here: Way: 1124785546 | OpenStreetMap and here: Way: ‪National Route 1‬ (‪1124785544‬) | OpenStreetMap). For this reason it becomes a ‘subnetwork’ and is excluded. highway=motorway is closed for the scooter profile, despite the motorcycle=yes tag. It would be accessible if there was a moped=yes tag. Maybe you know better: Would it be appropriate to tag moped=yes here or should the scooter profile include roads tagged as highway=motorway+motorcycle=yes?

Thank for your suggest. I found it. In my case, this way (Way: 1124785546 | OpenStreetMap , Way: 1181117200 | OpenStreetMap) accept highway=motorway+motorcycle=yes in the real. So I will custom my logic to apply this case.
Many thanks @easbar :hugs:

1 Like

Hi @easbar
I’m try to impl this logic with code in my class MotorcycleAccessParser.java

restrictHighwayValues.add("motorway");
restrictHighwayValues.add("motorway_link");

if (restrictHighwayValues.contains(highwayValue) && !intendedValues.contains(way.getTag("motorcycle"))) {
            return WayAccess.CAN_SKIP;
        }

it’s not work for all case.
Way 654694311 and 654694374 have same tag. but why I can’t snap to way 654694311

Probably because it is part of a subnetwork? You can check by clicking the ‘Show Routing Graph’ option in the layers menu and hovering the edges in GraphHopper Maps. The ways might be part of a subnetwork because you are still missing motorcycle=yes tags for the ways they lead into, like in your initial example.

Yes. I found missing tag in other way(1348259473). but I don’t understood why my route can not go straight ? I’m test on valhalla and osrm and saw It’s still work without update any things. So Do u have an ideal to fix this ?

Can not go straight where? GraphHopper detects roads that are not connected to the main road network and prevents snapping to them (subnetworks). Otherwise you would not find a connection between the snapped point and another point in the main road network (because it is not connected). You can disable this by setting prepare.min_network_size: 0 in your configuration file. You have to run a new import for this to take an effect.

1 Like

Sorry, I miss .
From : 10.328472180702358,105.51484107971193
To : 10.32814761469431,105.51406323909761

I change prepare.min_network_size: 0 and it’s work for all my test case. but I still don’t understand about subnetwork. I hope u can explain it for me :smiley: thanks

Quoting from config-example.yml:

 # In many cases the road network consists of independent components without any routes going in between. In
  # the most simple case you can imagine an island without a bridge or ferry connection. The following parameter
  # allows setting a minimum size (number of edges) for such detached components. This can be used to reduce the number
  # of cases where a connection between locations might not be found.

If there is some edge that is still not accessible (because of missing motorcycle=yes) such an ‘island’ will be created. So GraphHopper won’t snap at this location, because there would be no way out.