mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Mapbox walking routes not matching OSM OSRM routes?

Open streetwalker-unity opened this issue 1 year ago • 4 comments

Hi, we are using MapBox in unity and getting really bad walking routes using this call:

https://api.mapbox.com/directions/v5/mapbox/walking/

that is: routes that cross highways where there are no crosswalks; routes that go unnecessary way around to get to the destination.

However, if we go to OpenStreetMap.org and use their map and calculate routes using the OSRM walking option to plot a route between the same start and destination as we do using the above call, we get a really good walking route that has none of those problems.

So what is the difference? Does the MapBox directions API not use OSM for its data and OSRM for its route calculations???

If not, is there any way to get the routes we see at the OpenStreetMap.org site, short of us running our own OSRM server and using that instead of MapBox for route calculation?

streetwalker-unity avatar Jan 15 '25 18:01 streetwalker-unity

The Mapbox Directions API’s walking profile uses Valhalla instead of OSRM. You can tell because each instruction in English ends in a period, whereas OSRM always omits the period.

Tuning the walkway_bias parameter might help to make the routes more predictable in some cases. The default is completely neutral, which in some cities leads to routes that sometimes get off the sidewalk and into a bike lane or roadway as a shortcut. This issue also affects osm.org, so it’s possible that the issue is being compounded by something else on Mapbox’s side.

1ec5 avatar Jan 15 '25 18:01 1ec5

The Mapbox Directions API’s walking profile uses Valhalla instead of OSRM. You can tell because each instruction in English ends in a period, whereas OSRM always omits the period.

huh... last night researching this, I came across an announcement at the MapBox site stated that they are using the latest version of OSRM? I don't think I was dreaming...

So there is no choice on what calculator it uses?

Thanks for the tip about the bias!

streetwalker-unity avatar Jan 15 '25 19:01 streetwalker-unity

Mapbox (née MapBox) used to power all the Directions API profiles with OSRM. Several years ago, they switched the driving and walking profiles to Valhalla. I think cycling might still use OSRM (again based on the periods in the instructions).

1ec5 avatar Jan 15 '25 19:01 1ec5

well, bias does not seem to make any difference for this specific route, from -1 on to 1 they are all the same. Thanks for all the help. Looks like we will need to set up an OSRM server.

streetwalker-unity avatar Jan 15 '25 19:01 streetwalker-unity