mapbox / mapbox-java

The Mapbox Java SDK – Java wrappers around Mapbox APIs and other location data
https://docs.mapbox.com/android/java/overview/
MIT License
424 stars 120 forks source link

MapMatching Rigidly Follows Traffic Laws #1128

Open rdvelazquez opened 4 years ago

rdvelazquez commented 4 years ago

The mapMatching API doesn't work with routes that disobey traffic laws. We are providing routes for first-responders (fire, law-enforment, EMS, etc.) who don't always need to obey traffic laws so this is causing issues.

Here's an example (the image on the left is the recommended route; the image on the right is what is returned from mapMatching, not allowing the illegal left turn): Left-Turn Not Allowed

We are generating routes from our own OSRM server using custom profiles and want to use mapbox-navigation-ios for the navigation frontend. As noted in this tutorial and https://github.com/Project-OSRM/osrm-text-instructions/issues/269#issuecomment-449417857 the recommended approach is to use the mapMatching api to add voice and banner instructions to the custom generated route object (orsm-text-instructions could be used to add the simple text instructions but not the voice and banner instructions).

We don't even need the "matching" part of the mapMatching api... we already have the precise road geometry, we're not snapping fuzzy gps coordinates to a road network. We only need the voice and banner instructions but there doesn't seem to be a way to get just these without using the mapMatching API.

We could write our own package to produce the voice and text instructions based on the route object (returned from orsm) and the simple text instructions (returned from osrm-text-instructions) but it seems needless considering this is something already implemented by Mapbox but not available in any way (open source or api).

We plan to reach out directly to Mapbox support to talk about this but I wanted to post a public issue here so that other's could add to the discussion if they have similar issues or possible solutions.

related to #849

rdvelazquez commented 4 years ago

@danpat any insight on this?

betangaranga commented 4 years ago

Hi @rdvelazquez , our team is facing exactly the same issue. Any workaround on this so far? The only possible solution we found was to avoid the waypoints arguments in the builder, however, this makes the map matching algorithm to consider all the coordinates as waypoints

rdvelazquez commented 4 years ago

Hi @betangaranga we don't have a workaround yet. We looked at using waypoints as a workaround but the "arriving at your destination" at each turn was a deal breaker for us.

I'll let you know here if we find anything out.

danpat commented 4 years ago

@rdvelazquez Yep, I understand the issue here - this is definitely a known problem with the approach you're taking. I don't have any workarounds - the Map Matching API will, as you've observed, follow any rules/restrictions.

We've definitely discussed creating a profile for matching cases like this that disables restrictions/oneways/etc, but we've yet to find time to get that work on the schedule and offer it as an option. My suggestion would be to reach out to support or your account manager and make some noise about it so that it'll get in front of the right people to make it onto our development roadmap.

rdvelazquez commented 4 years ago

Thanks @danpat we have reached out to support and will continue to do so to make some noise about this issue. If there's anything else that we can do to move this along please let us know. It's currently a major roadblock in using Mapbox.

JasonDalton commented 4 years ago

@danpat Is there a way to decouple the voice instruction generator from Map Matching? If we already have a valid route from OSRM and we just need the banner and voice text. We don't actually need Map Matching at that point. Would be handy to either have a service to add the voice commands or an open source method to get the same.

rdvelazquez commented 4 years ago

For anyone else looking at this: https://github.com/Gadda27/maphopper converts GraphHopper routes to mapBox digestible routes. The logic in there could probably be repurposed to add voice and banner instructions to OSRM routes.