Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Mapbox welcomes participation and contributions from everyone.
- Added `DirectionsRefreshResponse#fromJson(Reader)`, a static factory method that deserializes a `DirectionsRefreshResponse` from a `java.io.Reader`.
- Added `FlattenListOfPoints` to hold a list of points in a more memory-efficient way.
- Deprecate `LineString#coordinates()` and `Point#coordinates()`. It's encouraged to use the new `flattenCoordinates()` methods.
- Added `DirectionsRoute#weightTypical` indicating the weight of the route under typical conditions.


### v7.9.0 - November 20, 2025
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ public static Builder builder() {
@Nullable
public abstract Double weight();

/**
* When using the driving-traffic profile, this will be returned as a double value
* indicating the weight of the selected route under typical conditions
* (not taking into account live traffic).
*/
@Nullable
@SerializedName("weight_typical")
public abstract Double weightTypical();

/**
* The name of the weight profile used while calculating during extraction phase. The default is
* {@code routability} which is duration based, with additional penalties for less desirable
Expand Down Expand Up @@ -296,6 +305,16 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Builde
@NonNull
public abstract Builder weight(@Nullable Double weight);

/**
* The weight of the selected route under typical conditions
* (not taking into account live traffic).
*
* @param weightTypical the weight of the selected route under typical conditions
* @return this builder for chaining options together
*/
@NonNull
public abstract Builder weightTypical(@Nullable Double weightTypical);

/**
* The name of the weight profile used while calculating during extraction phase. The default is
* {@code routability} which is duration based, with additional penalties for less desirable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,25 @@ public void directionsRoute_doesReturnVoiceLocale() throws Exception {
DirectionsResponse response = DirectionsResponse.fromJson(json);
DirectionsRoute route = response.routes().get(FIRST_ROUTE);

String voiceLanguage = route.voiceLanguage();
assertEquals("en-US", route.voiceLanguage());
}

@Test
public void directionsRoute_doesReturnWeight() throws Exception {
String json = loadJsonFixture(DIRECTIONS_V5_VOICE_BANNER_FIXTURE);
DirectionsResponse response = DirectionsResponse.fromJson(json);
DirectionsRoute route = response.routes().get(FIRST_ROUTE);

assertEquals((Double) 373.1, route.weight());
}

@Test
public void directionsRoute_doesReturnWeightTypical() throws Exception {
String json = loadJsonFixture(DIRECTIONS_V5_VOICE_BANNER_FIXTURE);
DirectionsResponse response = DirectionsResponse.fromJson(json);
DirectionsRoute route = response.routes().get(FIRST_ROUTE);

assertEquals("en-US", voiceLanguage);
assertEquals((Double) 321.5, route.weightTypical());
}

@Test
Expand Down
Loading