Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get more annotations #306

Open
G-ilian opened this issue Sep 15, 2023 · 0 comments
Open

Get more annotations #306

G-ilian opened this issue Sep 15, 2023 · 0 comments

Comments

@G-ilian
Copy link

G-ilian commented Sep 15, 2023

Hey guys,

I've been taking a look at the Directions API docs and some annotation params caught my attention, but I'm not able to return some of them using the mapbox-gl-directions plugin in a React application. So I came here and spend some time to study the plugin docs, I use this reference: https://github.com/mapbox/mapbox-gl-directions/blob/master/API.md#mapboxdirections .

From what I understand the only params that can be returned using the mapbox-gl-directions plugin is the congestion, is that right? Do I have any other params that I can get, how do I do that?

The way I'm doing it is this:

    ` const directions = new MapboxDirections({
      accessToken: process.env.REACT_APP_TOKEN_MAP_BOX,
      unit: 'metric',
      profile: 'mapbox/driving',
      geometries: 'linestring',
      controls: {
        inputs: false,
        instructions: false,
        profileSwitcher: false
      },
      congestion: true,
      annotations: 'congestion,distance,duration,speed'
    })`

If you have any tips for me to get the congestion, distance, duration and speed params from the route please tell me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant