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

Can't exclude ferries, tolls or motorways on the route #232

Closed
bbantsadze opened this issue Dec 16, 2019 · 6 comments
Closed

Can't exclude ferries, tolls or motorways on the route #232

bbantsadze opened this issue Dec 16, 2019 · 6 comments

Comments

@bbantsadze
Copy link
Contributor

I'm using the latest version: 4.0.2 and passing exclude parameter like this:

new MapboxDirections({
      accessToken: this.accessToken,
      unit: 'metric',
      profile: 'mapbox/driving',
      flyTo: false,
      styles,
      controls: {
        inputs: false,
        instructions: false,
        profileSwitcher: false
      },
      exclude: 'ferry'
    });

But it doesn't exclude ferries. What am i doing wrong?

@geografa
Copy link
Contributor

@bbantsadze could you please add the API request here as well? You can use the API Playground to generate the request URL: https://www.mapbox.com/api-playground/#/directions?_k=nhxwpq.

@bbantsadze
Copy link
Contributor Author

@bbantsadze could you please add the API request here as well? You can use the API Playground to generate the request URL: https://www.mapbox.com/api-playground/#/directions?_k=nhxwpq.

https://api.mapbox.com/directions/v5/mapbox/driving/-94.775876%2C29.364116%3B-94.772278%2C29.325585.json?geometries=polyline&steps=true&overview=full&language=en&access_token=

@geografa
Copy link
Contributor

@bbantsadze thanks for confirming this.

image

Looks like the exclude is working, however, the exclude parameter is not included in the plugin just yet (https://github.com/mapbox/mapbox-gl-directions/blob/master/src/directions.js#L19). If you'd like to contribute, you can create a pull request to have this added. In the meantime, you can still use the API directly and add specific parameters or use the Mapbox JavaScript SDK.

bbantsadze pushed a commit to bbantsadze/mapbox-gl-directions that referenced this issue Dec 18, 2019
@bbantsadze
Copy link
Contributor Author

Thanks for response. I checked and it worked, so created a pull request.

bbantsadze pushed a commit to bbantsadze/mapbox-gl-directions that referenced this issue Dec 20, 2019
tristen pushed a commit that referenced this issue Dec 30, 2019
* #232 - added `exclude` parameter

* #232 - added `exclude` parameter description in docs
@bbantsadze
Copy link
Contributor Author

Merge was completed. Thanks.

@Lazza
Copy link

Lazza commented Jul 29, 2020

There seems to be no way to toggle this option at runtime, am I missing something obvious?

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

3 participants