mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

Route arrived without covering route, if source and destination coordinates are nearby.

Open shreya-ja opened this issue 5 years ago • 3 comments

Scenario: Get a UTurn route on same straight street.

User starts from point A ( left side point of a street), moved towards end of street, Point B, make a right UTurn on same street, towards Point C, reaches the start of street but on right side, at point D

Route is - A->B->C->D

Preview A -------------------------------------------B (Same street - UTurn) D--------------------------------------------C

API Request

https://api.mapbox.com/directions/v5/mapbox/walking/-87.632965,41.903986;-87.632965,41.905703;-87.633065,41.905703;-87.633065,41.903986?access_token=""&geometries=polyline6&overview=full&steps=true&voice_instructions=true&banner_instructions=true&waypoints=0%3B3

Android API: Mapbox Navigation SDK version:

Steps to trigger behavior

  1. User starts from point A ( left side point of a street)
  2. Moved towards end of street, Point B
  3. Make a right UTurn on same street, towards Point C
  4. Reaches the start of street but on right side, at point D

Expected behavior

Route should stay on map till user cover the whole route, from start to destination.

Actual behavior

As soon as user reaches source coordinate, Route Rrived event fires. Mapbox navigation assumes route arrived as source and destination are nearby on same street. Without covering route (covering whole street), route arrived event fires without covering route.

Is there a way to tell mapbox that until user navigates on whole route, mapbox should not fire route arrive event, even if user arrives at destination without navigating on direction route???

shreya-ja avatar Sep 27 '20 16:09 shreya-ja

Hi @shreya-ja did you manage to fix this issue? We're experiencing the same issue with routes that are in a loop, origin and destination coordinates being the same. Would adding intermediate waypoints solve it?

jackgregory avatar May 13 '21 10:05 jackgregory

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 01 '22 15:05 stale[bot]

Hi @shreya-ja did you manage to fix this issue? We're experiencing the same issue with routes that are in a loop, origin and destination coordinates being the same. Would adding intermediate waypoints solve it?

I got really late in replying. Sorry about that. What I did in order to fix the issue in my app was, I first checked in "RouteProgressObserver" if the status of route is "Arrived" then I put an additional condition if the distanceRemaining is less than 1.5 mt or 2.0 mt, thereafter follow the next steps in application. This way I was able to encounter the issue.

Or additionally you can also compute the distance between start and end points before making a mapbox directions API call. If that distance is less than 5 mt or so, then you can avoid making a mapbox call. For that you can use distanceTo() function from "Turf SDK"

shreya-ja avatar May 02 '22 07:05 shreya-ja