Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.21k stars 3.29k forks source link

Add names annotation #3964

Open danpat opened 7 years ago

danpat commented 7 years ago

We've been focusing on improving guidance for human consumption. The steps returned in the API response are currently designed to provide the "most relevant instructions to a human". One of the driving usability features is to try to reduce the cognitive load by only supplying the minimum instructions necessary to unambiguously follow a route.

However, there are some analysis use-cases that don't want this heuristic: exhibit 1.

Instead of adding complex behaviour to our guidance code to not-collapse redundant instructions, I propose we add support for annotations=names - this would add to the existing annotations response, giving names for every segment along the returned route.

This would neatly (and optionally) solve the analysis use-case that we've seen pop up a few times, and require no changes to the guidance code. The name information should be readily available for adding to annotations. I haven't really dug into this codepath yet, but I think it should be relatively straightforward.

grischard commented 4 years ago

This would also be very useful when you want to show the current street name on a HUD.

mahsu commented 2 years ago

Hi @danpat , I'm running into a similar issue where I'd like access to the uncollapsed set of steps for machine analysis purposes. In particular, I'm amending the name field to include the OSM wayId and other pieces of metadata. After computing a route, I'm hoping to get back all steps so it's possible to visually inspect each segment with a unique name. I know this isn't officially supported, but I see that this use-case has come up a handful of times already:

The current approach we're going with adds a parameter to the route api that conditionally runs some of the step-collapsing guidance logic, which seems to be working well.

I think in this particular case, the annotations approach may not solve this use-case because I would also like the geometries for each individual segment.

For various maintenance reasons, I'd prefer to not run an additional service given that this information is already available in OSRM.

I'm wondering what the team thinks about supporting an approach here in OSRM. Happy to give this a shot if there's support.