Osrm-backend: Osrm routing response returns long distances

Created on 23 Aug 2019  路  5Comments  路  Source: Project-OSRM/osrm-backend

I am trying to get the route distance between two coordinates which are just 3.5kms away from each other. (38.905594437419346,-75.87934669114266) & (38.8964389684041,-75.84294618114441)

Osrm route api chooses a different road instead of the highway and it returns distance as 14kms.
But when i interchange the starting and destination points it gives the correct distance and routes through the highway road.

https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=38.9146%2C-75.8933%3B38.8970%2C-75.8559#map=14/38.9194/-75.8660

All 5 comments

The south-east bound lane there has construction=trunk - by default, OSRM won't route over construction zones.

It could be argued that OSRM should route over highway=trunk, construction=trunk because it's not marked as highway=construction, but the tagging scheme isn't super clear hear about whether vehicles are permitted in these construction zones or not. OSRM errs on the side of caution and tries not to route people down roads that may not be accessible.

Here is another example of a long route:
https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=29.7156%2C-90.5648%3B29.8474%2C-90.4476#map=11/29.8912/-90.5209

Compare with the public osrm client which doesn't have that issue (older dataset?)
http://map.project-osrm.org/?z=12&center=29.781364%2C-90.506058&loc=29.715624%2C-90.564779&loc=29.847436%2C-90.447558&hl=en&alt=0

I tried to see if the section of road in question has construction=trunk in OSM data but it doesn't. I only see highway=trunk.
See: https://www.openstreetmap.org/edit#map=18/29.71668/-90.56294

@drewlesueur The problem in this case (on this I90 way: https://www.openstreetmap.org/way/543439785), is that it has proposed=motorway - the default OSRM profiles treat that the same as construction.

The OSM wiki isn't super clear on this: https://wiki.openstreetmap.org/wiki/Key:proposed

It looks like it's proposed that this road be upgraded from a trunk to a motorway, but it's an existing functional road. proposed= I think was intended to mark out roads that don't yet exist (and thus shouldn't be routable).

I'd contact the OSM editor who added the proposed= tag on https://www.openstreetmap.org/way/543439785 and see if that was what they meant.

Very helpful. Thank you so much.

It could be argued that OSRM should route over highway=trunk, construction=trunk because it's not marked as highway=construction

Thank you, that inspired me to come up with a solution that works for my use case -- edit profiles/lib/way_handlers.lua to be more picky about when it rejects ways tagged construction=* or proposed=*.

For whoever is interested, the following changes will:

  • only reject proposed=* ways only if highway=proposed too
  • only reject construction=* ways if highway=construction too

Change:

if profile.avoid.construction then

to:

if profile.avoid.construction and data.highway == "construction" then

And then change:

if profile.avoid.proposed and way:get_value_by_key('proposed') then

to:

if profile.avoid.proposed and data.highway == "proposed" and way:get_value_by_key('proposed') then
Was this page helpful?
0 / 5 - 0 ratings

Related issues

MouadSb picture MouadSb  路  3Comments

freenerd picture freenerd  路  4Comments

pat841 picture pat841  路  4Comments

Oyabi picture Oyabi  路  5Comments

RajibChanda picture RajibChanda  路  4Comments