I used .pbf file for a routing package and .osm file for another. But the route for my locations are totally different. Why is that? Is there any chance that .pbf and .osm files are different?
Did you use the same routing engine in both cases? Each routing engine calculates differently the route between two points, based on the settings you have provided.
No two are different. But I am trying to match the road speeds. As both takes fastest route, the time to traverse a road shouldn’t be same based on road speed?
So, both are taking the exact same route, but with different time estimation? Maybe one of the two routings considers also the surface of the road (if available). Maybe it also considers road bends (as you typically slow down when in a really tight turn, even if there aren’t usually any signs denoting the specific speed you need to have at such road), which would make that routing pretty smart to be honest, because I don’t think many are that realistic in estimation.
Actually they do not take same route. That’s why I am trying to understand- even if the road speeds are same, why they take different route. I understand that one router create their own graph from .pbf file and another from .osm file. As I am using the fastest routing to calculate a route in both of them, I expected that the route would be same after i match their road speed. But they are not. So, that’s why I am thinking if the.pbf and .osm files are same or different.
Please let me know what you think and is there any other way I can find the reason for the route difference.
You can do what it was suggested above with osmium and check there if there’s any difference, but I assume the data for this specific area shouldn’t be different between the two.
On wiki there are some info on what typically is taken into consideration for routing, but as I said earlier, each routing engine takes different approach for the same points.
If you could give a link/co-ordinates of the area on OSM, we could see if there’s something obvious which would lead into the different route.
Thank you. I never used osmium before but will definitely try it and let you know.
I extracted the files from https://extract.bbbike.org/. It contains Washington DC, several counties of Maryland and Virginia. The upper left x,y coordinate of bounding box: -77.26999, 39.05163 and lower right: -76.83809, 38.76684. The x,y for origin: -76.870561,38.828252, destination: -77.070984, 38.99845.
With first glance, the 1st one you showed earlier seems to take the most proper route from the airport, using the Capital Beltway. I can’t really see why the second one goes from the city center though.
I think a better approach is to use osmium-cat or some other tool to convert the .pbf file into a .osm file and the .osm file into the .pdf file and redo the routing test. That will reveal if the differences in .pbf versus .osm or in the routing tools.
Can you share which routing tools you are using and what is the start/end? That way others can help you easier.
Thank you for your response. I used osmconvert to convert the .osm file to .pbf file and ran it again in GraphHopper. The result is same as previous. So, I guess those 2 file formats are similar.
I then tried to match road speed and ran it again in GraphHopper. For some routes it is producing similar routes to the other platform (looks like for major highways) but for some routes it produces more different results than it previously did.
Okay, so confirmed that the files are the same and the difference is in the router/configuration of the router.