Route types

Allow your users to plan a route that will be the fastest, shortest, most thrilling, or environment friendly.

Sample use case: You plan a trip from Amsterdam to Rotterdam and want to compare ETAs for different types of routes to choose the best fit your preferences.

Available route types:

1routeType = RouteType.FASTEST
2routeType = RouteType.SHORTEST
3routeType = RouteType.ECO
4routeType = RouteType.THRILLING

To request a route for a specified travel type:

JAVA
KOTLIN
1RouteDescriptor routeDescriptor = new RouteDescriptor.Builder()
2 .routeType(routeType)
3 .considerTraffic(false)
4 .build();
5
6RouteCalculationDescriptor routeCalculationDescriptor = new RouteCalculationDescriptor.Builder()
7 .routeDescription(routeDescriptor)
8 .maxAlternatives(0)
9 .reportType(ReportType.EFFECTIVE_SETTINGS)
10 .instructionType(InstructionsType.TEXT)
11 .build();
12
13RouteSpecification routeSpecification = new RouteSpecification.Builder(
14 routeConfig.getOrigin(),
15 routeConfig.getDestination()
16)
17 .routeCalculationDescriptor(routeCalculationDescriptor)
18 .build();
1val routeDescriptor = RouteDescriptor.Builder()
2 .routeType(routeType)
3 .considerTraffic(false)
4 .build()
5
6val routeCalculationDescriptor = RouteCalculationDescriptor.Builder()
7 .routeDescription(routeDescriptor)
8 .reportType(ReportType.EFFECTIVE_SETTINGS)
9 .instructionType(InstructionsType.TEXT)
10 .build()
11
12val routeSpecification = RouteSpecification.Builder(origin, destination)
13 .routeCalculationDescriptor(routeCalculationDescriptor)
14 .build()

Route type eco

Route type fastest

Route type shortest