I recently found out about Graphhopper after trying out OsmAPP.org and testing a route. I’ve been mapping a village near my home town and wanted to test the routing in case I’d missed anything. I found that OsmAPP was sending me on a bit of a strange route if I selected a car route, taking side streets and back lanes instead of following the main road. If I selected a bicycle though, it would follow the main road.
Trying the same route on openstreetmap.org would take me the same round about way when using a car with Graphhopper, but would take me the correct way when using OSRM. Selecting bicycle with OSRM takes me directly to a cycle route rather than following the main road.
All the car routes have an illegal U turn near the start, which I’m about to fix, but as Graphhopper and OSRM are routing differently, I don’t know whether it’s an issue with the OSM data or a routing issue with Graphhopper. Just to complicate things - as it’s a small village, most of the roads are small named roads, rather than A or B roads, so have similar priority. The main road is a bus route though, if that helps.
I’d be grateful if someone could point me in the right direction to solve this.
You already (correctly) added the no u-turn relation in OSM. But it will take a few days until changes in OSM data are picked up by the routing engines.
Regarding the rest of the route: What do you consider the correct way and why? The most important OSM tag for routing is highway. Usually routing engines will prefer a tertiary over a residential road etc.
Rather than taking a direct route, it’s directing traffic up a narrow track at the side of a park, then cutting through a small lane, before joining a narrow side street, then crossing the main road to go down more narrow streets and a single car width riverside road that’s essentially a lane.
I can’t see any logical reason for the directions, other than ‘this road exists’. To get to the park road, the route takes a 90 degree turn off the main road that has the bus route. It would be both faster and easier to stay on the main road.
I see. OSM routing strongly relies on the correct use of the highway hierarchy. If the ‘main road’ is not tagged with a highway type higher up in the hierarchy it will typically not be preferred over other routes that are less comfortable to drive on. Same with the narrow track. If it isn’t tagged as such it won’t be avoided by the algorithm. Did you check if the highway tags of the roads in this area match their definition?
I did not check in detail, but to me it looks like the highway=unclassified tag might be used incorrectly. See this route for example where the algorithm suggests a big detour to avoid Brynmair Rd via Foundry View (clearly the smaller road). link
It doesn’t look like it’s just highway=unclassified. I just tried checking another section just before the section that you tried, and I’m being directed along a service road rather than the residential road if I select a scooter as the mode of transport. Cars, small trucks, and trucks are being directed away from the residential road to the unclassified roads around the park, scooters get sent either on the unclassified road or a service alley, cycles get sent along the residential main road, and foot traffic can also use the path through the park:
This is all because of the wrong usage of highway=residential and highway=unclassified, in my opinion. According to the OSM wikihighway=unclassified is meant to be used for roads with “the lowest priority in the interconnecting road network”. Interconnecting means it should be used for roads with transit traffic. highway=residential is meant for roads that “are not normally used as through routes”.
So the ‘main road’ you mentioned (I assume this one) should be unclassified or higher (tertiary, secondary, primary). And the road at the side of the park (as well as the Foundry View by the river) should be residential or lower (e.g. track).
Then again in OSM it is always possible local mapping communities agreed on their own definitions of the tags, so better check how these highway types are used in areas nearby.