osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.4k stars 989 forks source link

Directions differ between OSMAnd and OSRM website for same route #6674

Closed mds08011 closed 4 years ago

mds08011 commented 5 years ago

Bug description

The OSRM navigation directions in OSMAnd are different than what I see for the same route in the OSRM website.

I initially noticed that in OSMAnd, the route highlight lines seem closer to simplified jagged approximations than the complex OSRM routes I am used to seeing in a web browser. When I enter the same origin and destination in both OSMAnd and the OSRM website, I see the same general path of travel but the list of directions is different. OSMAnd seems to only be giving directional steps but not the usual more complex routing instructions. For example, for the same point in my route where I will be exiting a highway, the OSRM website says to “Take Exit 9 towards Main Street”, while OSMAnd states “turn slightly right” for the same action. My screenshots below highlight this example.

My OSMAnd should be using OSRM for routing, so I am not sure why this discrepancy is occurring.

This topic initially started on the Google Groups Forum: https://groups.google.com/forum/#!topic/osmand/PV6JayvXZPI

Device info

OSMAnd version: 3.3.4 (OSMAnd+) Device: Google Pixel 2 Android version: 9.0 (P/Pie)

OSMAnd Settings

Do you use the offline maps offered within the OsmAnd app for download, or online (tile / raster) maps?

I use downloaded maps and am an OSMAnd Live subscriber.

Routing

Tell us whether you have used OsmAnd's in-app offline routing, or any online routing provider like YOURS, OpenRouteService or OSRM.

OSRM Navigation service

What routing profile is chosen in OsmAnd app? (car, bike, pedestrian, fastest or shortest)

Car profile, fastest route.

Starting Location 3000 E Street San Diego, CA 92102

Ending Location 9449 Balboa Avenue San Diego, CA 92123

OSRM Route: http://map.project-osrm.org/?z=13&center=32.765914%2C-117.117090&loc=32.715299%2C-117.129285&loc=32.821954%2C-117.126434&hl=en&alt=0

Screenshots

OSMAnd (using OSRM) route from 3000 E Street San Diego, CA 92102 to 9449 Balboa Avenue San Diego, CA 92123:

OSRM website route from 3000 E Street San Diego, CA 92102 to 9449 Balboa Avenue San Diego, CA 92123: OSRM-Demo

vshcherb commented 5 years ago

I checked the source code and it is also visible in the logs but URL is correct: https://router.project-osrm.org/route/v1/driving/ So I have no idea why routing is different for API and the website

mds08011 commented 5 years ago

That's odd. Thank you for looking into it!

The route highlight lines I am seeing in OSMAnd look very simplified with straight lines even on curved roads (screenshots below). Are there any settings in OSMAnd I should check, or does this seem entirely related to the API? I use online OSRM routing with downloaded OSMAnd maps.

jfburke3 commented 5 years ago

Just from my observation as a user, it looks like OsmAnd is treating the OSRM route as a gpx track with sparsely placed waypoints, especially given the text directions shown.

jfburke3 commented 5 years ago

Is OSRM only returning a sparse gpx route to OsmAnd?

sonora commented 5 years ago

Yes, the first two screenshots in this thread indicate the native OSRM route with all sorts of details while the route details screen in OsmAnd shows only very basic turn info. Could well be that the API only returns a gpx with track points and no full route info, or maybe the API allows for an option we are not setting. But at first sight I find no info on their web site.

danpat commented 5 years ago

👋 OSRM dev here.

Looking at the OSMAnd code - https://github.com/osmandapp/Osmand/blob/c8ccf21c737e239dda267c89ef2edf504ad9d3e6/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java#L1076

it looks like there are a bunch of API parameters missing that would fix this.

I would add:

?steps=true&overview=full

to the request being made.

overview=full will give you a non-simplified geometry back - the default that OSRM returns is a simplified response designed for route overview, not for rendering at high zoom levels on a map.

steps=true will return all the correct step-by-step instructions that you can see on the OSRM demo website. In the API response, the steps: [] element will be populate with objects that describe the step-by-step instructions that you'd want to present to a user: http://project-osrm.org/docs/v5.22.0/api/#routestep-object

I have no idea if these map through to existing OSMAnd concepts, but I'd say that because they're not being used, you're missing out on a bunch of OSRM's functionality by default.

vshcherb commented 5 years ago

Hi @danpat Thanks for introduction we are planning to upgrade it in future release!

vshcherb commented 4 years ago

OSRM option is removed for now and we decided to postpone that task a bit.