mapbox / mapbox/navigation.js

findNextStep() needs more context

Open
#12 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
33
Forks
7
PR merge metrics
No merged PRs in 30d

Description

`findNextStep()` essentially treats the route line as an unordered set of points, ignoring the route line’s directionality. It always returns the closest step, but that isn’t always correct. For example, when the next step is a U-turn, a later step may be closer than the U-turn. Assuming the route line is correct, client code will end up instructing the user to turn right into a grass field rather than turning right onto the side street:

uturn

To handle this and other cases correctly, we need to keep track of which steps along the route line have already been completed and simply return the first uncompleted step. (Client code should periodically call `shouldReRoute()` to handle the case where a step has been skipped successfully.) In other words, finding the next step is less of a spatial problem and more of a problem of checking items off a list.

/cc @bsudekum @mikemorris

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating findNextStep() and reading how it evaluates route-line points and steps. Trace the interaction with shouldReRoute() and the client code, then define completion as returning the first uncompleted step while preserving rerouting when a step has been skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.