mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
621 stars 319 forks source link

Supprot exclude multiple types or add more routing profiles #3844

Open peytonwupeixin opened 3 years ago

peytonwupeixin commented 3 years ago

Android API:29 Mapbox Navigation SDK version:1.2.0

Actual behavior

Hi Mapbox team, Our vehicle is a commercial vehicle,and we need to routes avoid roads where commercial vehicles are not permitted. Currently,we have to request directions apiwith profile=mapbox/driving-traffic and exclude=toll(the exclude option only can be one of toll,motorway and ferry).The route is not very suitable for our needs sometimes.

Expected behavior

Do we have plan to add routing profiles(eg.profile=mapbox/driving-commercial) or exclude multiple types in one request.(eg exclude=toll,motorway,ferry)?

Guardiola31337 commented 3 years ago

Hey @peytonwupeixin thanks for your request here. Unfortunately, this is a limitation of the Directions API itself. It currently does not allow multiple excludes per request.

That said, our Directions team is actively thinking about this and we will be sure to update the SDK as soon as that work lands upstream. I do not have a solid timeline on that work at this time. Thank you for understanding!

@danpat @danpaz feel free to add more color here.

Guardiola31337 commented 3 years ago

My bad, I believe multiple excludes is currently supported for driving and driving-traffic profiles. Make sure to include the types separated by commas through RouteOptions.exclude. Is that correct @danpat @danpaz?

danpaz commented 3 years ago

Multiple excludes will work on the driving profile (though it's undocumented behavior), but not on the driving-traffic profile as of today. We do plan to roll out support for multiple excludes on the driving-traffic profile sometime early next year as well as formal documentation when it's launched. No plans for a "mapbox/driving-commercial" routing profile that I'm aware of.

ArielSmoliar commented 3 years ago

@peytonwupeixin would you be available next week to jump on a quick call with @danpaz and me to discuss your use cases?

EricGeiler commented 3 years ago

I would be very interested in this potential feature as well, we are struggling with the same use case in Canada.

- Eric G. A&B Courier Service.

jcloquell commented 3 years ago

Hi there! Thanks for sharing this, I was looking for the same thing and just tried to include multiple types separated by commas and it works fine with the "driving" profile, so you can exclude motorways, tolls and ferries at the same time 👍

However, I saw that there are 2 more values in the ExcludeCriteria - EXCLUDE_TUNNEL and EXCLUDE_RESTRICTED. I know it is not documented that they can be used to request routes, but I was hoping I could use them to get better routing in certain areas, as some of our clients are complaining about some routes going through "quiet streets with 10 km/h speed limit" (just an example). If I include one of them in the RouteOptions.exclude it fails to calculate the routes with this exception:

com.mapbox.navigation.utils.NavigationException: Error occurred fetching offline route: Malformed exclude - Code: 0
        at com.mapbox.navigation.route.internal.onboard.MapboxOnboardRouter$retrieveRoute$1.invokeSuspend(MapboxOnboardRouter.kt:140)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

So I'm wondering, what are these 2 values for? Are there plans to "enable" them in the future? I'm specially interested in the EXCLUDE_RESTRICTED one, as it sounds like it could solve some of the issues our clients are complaining about, but I might be completely wrong.

Sorry if the questions are a bit off-topic. Thanks!