You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RouteOptions.roadClassesToAvoid accepts any value in RoadClass, including tunnel, but the Directions API doesn’t support excluding tunnels in its exclude parameter.
Originally, in #154, the assumption was that intersections.classes would only ever indicate classes that the request could exclude. Project-OSRM/osrm-backend#4812 broke this assumption, adding tunnel as a class but not an excludable class. #237 effectively added it as both.
We’ll eventually need to decouple the exclude parameter from the concept of road classes, due to changes like #662, but we can’t formally do that until v3.0.0 due to backwards compatibility concerns. For the time being, we’ll have to settle for updating this documentation comment to note that the option can only be used in the context of Intersection.outletRoadClasses, not RouteOptions.roadClassesToAllow or roadClassesToAvoid:
We could also actively omit tunnel when converting RouteOptions to a request URL, but it doesn’t look like we do that for any other option that’s supported by only one of RouteOptions.roadClassesToAllow or roadClassesToAvoid. In general, we try to avoid client-side enforcement of server-side constraints, in case the Directions API relaxes those constraints in a future deployment or conditionally by user.
However, I decided to hardcode supported avoid and include road classes in the separate internal arrays, to filter omit unsupported road classes while creating a URL request.
RouteOptions.roadClassesToAvoid
accepts any value inRoadClass
, includingtunnel
, but the Directions API doesn’t support excluding tunnels in itsexclude
parameter.Originally, in #154, the assumption was that intersections.classes would only ever indicate classes that the request could exclude. Project-OSRM/osrm-backend#4812 broke this assumption, adding
tunnel
as a class but not an excludable class. #237 effectively added it as both.We’ll eventually need to decouple the
exclude
parameter from the concept of road classes, due to changes like #662, but we can’t formally do that until v3.0.0 due to backwards compatibility concerns. For the time being, we’ll have to settle for updating this documentation comment to note that the option can only be used in the context ofIntersection.outletRoadClasses
, notRouteOptions.roadClassesToAllow
orroadClassesToAvoid
:mapbox-directions-swift/Sources/MapboxDirections/RoadClasses.swift
Lines 49 to 54 in 2db7fda
We could also actively omit
tunnel
when converting RouteOptions to a request URL, but it doesn’t look like we do that for any other option that’s supported by only one ofRouteOptions.roadClassesToAllow
orroadClassesToAvoid
. In general, we try to avoid client-side enforcement of server-side constraints, in case the Directions API relaxes those constraints in a future deployment or conditionally by user./ref mapbox/mapbox-java#709
The text was updated successfully, but these errors were encountered: