Skip to content

Get more annotations #306

@G-ilian

Description

@G-ilian

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions