Skip to content

Conversation

@Guardiola31337
Copy link
Contributor

@Guardiola31337 Guardiola31337 commented Sep 16, 2021

Opening this as a Draft until Directions team deploys include params from their side in production. For now, we can test it in Staging using a SNAPSHOT from https://github.com/mapbox/mapbox-navigation-android

cc @browndp08 @ktatterso @kelseylivingston @zugaldia @jill-cardamon

public static final String EXCLUDE_RESTRICTED = "restricted";

/**
* TBD.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktatterso could you share the docs?

public static final String INCLUDE_HOV2 = "hov2";

/**
* TBD.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktatterso could you share the docs?

Comment on lines 357 to 358
* Include certain road types from routing. The default is to not include anything from the
* profile selected. The following include flags are available for each profile:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktatterso is this accurate? If not, could you share the docs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Include certain road types from routing. The default is to not include anything from the
* profile selected. The following include flags are available for each profile:
* Include certain road types in routing. By default, none of the road types listed below are included. The following include flags are available for each profile:

public static final String INCLUDE_HOV3 = "hov3";

/**
* TBD.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktatterso could you share the docs?

@zugaldia
Copy link
Member

API support for this feature has landed, we're good to proceed merging this PR and issuing a release.

/cc: @browndp08

Comment on lines 357 to 358
* Include certain road types from routing. The default is to not include anything from the
* profile selected. The following include flags are available for each profile:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Include certain road types from routing. The default is to not include anything from the
* profile selected. The following include flags are available for each profile:
* Include certain road types in routing. By default, none of the road types listed below are included. The following include flags are available for each profile:

Comment on lines 1219 to 1220
* Include certain road types from routing. The default is to not include anything from the
* profile selected. The following include flags are available for each profile:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

* @return this builder for chaining options together
*/
@NonNull
public abstract Builder include(@Nullable @DirectionsCriteria.IncludeCriteria String include);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include only one parameter, or can it be a list? If the latter, we should also expose a List method variant and test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this should be part of the mapbox-java for both include and exclude, same as all the other list paramaters.

@Guardiola31337 Guardiola31337 changed the title Expose include-hov/hot parameters Expose include-hov/hot parameters and add exclude list option Sep 23, 2021
@Guardiola31337
Copy link
Contributor Author

Addressed the feedback. This is ready for another round of eyes @mapbox/navigation-android

Copy link
Contributor

@abhishek1508 abhishek1508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add some more tests on what happens if we exclude or include some criteria for a profile that is not supported? For ex: a test for what happens if Profile.Walking and you add Include.HOV2

.exclude(DirectionsCriteria.EXCLUDE_TOLL)
.excludeList(new ArrayList<String>() {{
add(DirectionsCriteria.EXCLUDE_TOLL);
add(DirectionsCriteria.EXCLUDE_TUNNEL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test uses a DirectionsCriteria.PROFILE_DRIVING_TRAFFIC and excludes TUNNEL, but TUNNEL exclude is not mentioned in the documentation above. If DRIVING and DRIVING_TRAFFIC both support TUNNEL as exclude could you please add it to the documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. That being said, Directions team is working on supporting the DRIVING_TRAFFIC profile in the short term mapbox/mapbox-navigation-android#3844 (comment)

In order to be more accurate, I can fix the tests to use DRIVING profile instead 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback, but I meant this:

A list of exclude. Exclude certain road types from routing.
     * The default is to not exclude anything from the profile selected.
     * The following exclude flags are available for each profile:
     * <p>
     * {@link DirectionsCriteria#PROFILE_DRIVING}: One of {@link DirectionsCriteria#EXCLUDE_TOLL},
     * {@link DirectionsCriteria#EXCLUDE_MOTORWAY}, or {@link DirectionsCriteria#EXCLUDE_FERRY}.

In the test you are using EXCLUDE_TUNNEL for PROFILE_DRIVING, but the documentation does not mention that it is supported. Could you add {@link DirectionsCriteria#EXCLUDE_TUNNEL} to the documenation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to fix the tests and use ferry for example. tunnel is not supported based on https://docs.mapbox.com/api/navigation/directions/

Profile Available excludes
mapbox/driving One or more of toll, motorway, ferry, or unpaved
mapbox/driving-traffic One or more of toll, motorway, ferry, or unpaved
mapbox/walking No excludes supported
mapbox/cycling ferry

Thanks for confirming @danpat

@Guardiola31337
Copy link
Contributor Author

Could we add some more tests on what happens if we exclude or include some criteria for a profile that is not supported?

I think those are developer misconfigurations that we shouldn't handle from the client side. We threw exceptions in the past but we decided it wasn't a good idea and let Directions API handle it. Actually if tomorrow Directions API wants to support one more profile we'd need to change it from our side and cut a new release. I'd vote for avoiding that.

@Guardiola31337
Copy link
Contributor Author

Thanks for the feedback @abhishek1508 I've addressed it so this is ready again for another round of 👀

@Guardiola31337
Copy link
Contributor Author

@kmadsen @abhishek1508 OK ready for a final round of 👀

Copy link
Contributor

@abhishek1508 abhishek1508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback @Guardiola31337

@Guardiola31337 Guardiola31337 merged commit 42fa584 into main Sep 23, 2021
@Guardiola31337 Guardiola31337 deleted the pg-add-include branch September 23, 2021 20:06
public abstract String exclude();

/**
* A list of exclude.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is needed. Redundant with the @return and there is already a description

Suggested change
* A list of exclude.

public abstract String include();

/**
* A list of include.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, don't think this is needed.

Suggested change
* A list of include.

public abstract Builder exclude(@Nullable @DirectionsCriteria.ExcludeCriteria String exclude);

/**
* A list of exclude. Exclude certain road types from routing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* A list of exclude. Exclude certain road types from routing.
* Exclude certain road types from routing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose include-hov/hot params in RouteOptions

5 participants