Why graphhopper generates a longer route?

The road circled in red is the one I just edited on Osm and wasn’t originally on this map. It seems to work, as you can see it is on the map now, but the strange thing is that the graphhopper engine doesn’t produce a proper path, but a longer path, which is not what I want.

Please share a link of the route you think is incorrect.

https://graphhopper.com/maps/?point=31.232839%2C121.406667&point=31.234665%2C121.408716&locale=zh-CN&elevation=true&profile=car&use_miles=false&selected_detail=Elevation&layer=Omniscale

I want the car to follow the same route as the bike, which is the same route as the actual taxi’s gps track. When I edited the white road on OSM, I set it to be accessible for any vehicle. Why did the graphhoper choose a longer route for a car while shorter one for a bike?

Note that not only the route but also the destination point changes between car and bike. The red marker is the same, but the destination point ‘snaps’ to a different point of the road network. And apparently the white road is not accessible for cars, so GraphHopper snaps to this smaller road next to it and consequently the calculated route is very different.


I set it accessible for cars, but it’s still not working

It takes some time (a couple of days until the data is updated on graphhopper.com). Did you try to import the data yourself? The road used to be a oneway road, maybe this is the reason it was not routeable.

https://graphhopper.com/maps/?point=31.234229%2C121.412051&point=31.234977%2C121.412256&locale=zh-CN&elevation=true&profile=car&use_miles=false&selected_detail=Elevation&layer=Omniscale

how about this one, also oneway road, but routeable. I tried another one, but it was updated on graphhoper.com the next day, so I think the road has been updated as well.

Well sure in general oneway roads can be routed (when you go the right direction), I was just wondering why this route was not routeable even before you edited it. There could be some kind of combination of oneways with turn restrictions for example, but I am only guessing.

It seems that the routing data for each kind of vehicle is updated on its own schedule, so you perhaps got lucky with the “next day” experience. Sometimes it takes closer to a week.

Perhaps watch this routing for a few more days to look for the update.

https://graphhopper.com/maps/?point=31.468258%2C121.342538&point=31.456673%2C121.323094&locale=zh-CN&elevation=true&profile=car&use_miles=false&selected_detail=Elevation&layer=Omniscale

https://graphhopper.com/maps/?point=31.468258%2C121.342538&point=31.457295%2C121.324382&locale=zh-CN&elevation=true&profile=car&use_miles=false&selected_detail=Elevation&layer=Omniscale

Why are the ways of routing so different in these two situations? I hope the first will have the same effect as the second.

It looks like these two routes are very similar in time, even though the distance is quite different. And GraphHopper chooses the one with the slightly smaller travelling time. You can make GraphHopper focus more on shorter distance routes using e.g. the distance_influence parameter in custom_model.

That means the createRouter().calcPath() method doesn’t calculate the shorter route between two candidates if I don’t set the distance_influence parameter? I’ve been working on a map matching algorithm and takes advantage of path finding functions provided by Graphhopper. I need a way to calculate all the possible routes between two candidates, so I can select a proper route for the gps tracks. (I just tried this method, and it only generates one path, maybe the smaller travelling time one, and it’s not the path I want)

9
The GPS sampling points are disconnected in the middle

This depends on the weighting that is used. For example there is the FastestWeighting which finds the fastest route or the ShortestWeighting which finds the shortest route. The distance_influence parameter can be used with the CustomWeighting and yields a compromise between a fast, but still short route. There is also the FastShortestWeighting which does the same with this regard.

Can I set different weighting in the web? I didn’t find the way to set it

Yes, you can adjust the custom model. For example like this:

image

still doesn’t work

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