mapbox / mapbox/mapbox-gl-directions

query doesn't work

Open
#106 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
255
Forks
130
PR merge metrics
No merged PRs in 30d

Description

No matter what I seem to try, the query api method does not work. It keeps throwing an exception that it's not a function and indeed I can't see it in the bundle. I can however see a call to the mapbox api returning json data.

I can get the basic example working where it shows the inputs and routes from input. I'm now trying to supply it data to do the same thing but without the inputs. There is no documentation on it and the few examples I have tried have used something along the lines:
let directions = new MapboxDirections({
accessToken: ,
unit: 'metric',
profile: 'driving',
geocoder: MapboxGeocoder,
controls: {inputs: false}
});
directions.setOrigin([this.lng, this.lat]);
directions.setDestination([153.075892, -27.561993]);
data = directions.query();

-----
map.addSource({"someid", data: {data});

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 at the MapboxDirections constructor and the setOrigin, setDestination, and query() calls shown in the issue, then compare them with the basic example and the generated bundle. Done means the supported way to provide coordinates without input controls is established and the exception or documentation gap is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.