Routing with departure/arrival time
Allow your users to get a route planned for a specific arrival and departure time so they can use this information to adjust their commute plans.
Sample use case: You have a busy schedule and you need to plan your day optimally. You can use the arrival at option to learn when you need to depart to be at a specific time at a specific place. You can use depart at to know the time of arrival to the place you have your next appointment at.
In the following example you can see an implementation of using the arrive at and depart at parameters for a trip from Amsterdam to Berlin using the departAt parameters. The departAt value must be in the future. The departAt parameter cannot be used in conjunction with arriveAt.
1RouteDescriptor routeDescriptor = new RouteDescriptor.Builder()2 .departAt(departureTime)3 .considerTraffic(false)4 .build()56RouteCalculationDescriptor routeCalculationDescriptor = new RouteCalculationDescriptor.Builder()7 .routeDescription(routeDescriptor)8 .reportType(ReportType.EFFECTIVE_SETTINGS)9 .instructionType(InstructionsType.TEXT)10 .build();1112return new RouteSpecification.Builder(routeConfig.getOrigin(), routeConfig.getDestination())13 .routeCalculationDescriptor(routeCalculationDescriptor)14 .build();
The date and time of arrival at the destination point must be specified as a dateTime. The arriveAt value must be in the future. The arriveAt parameter cannot be used in conjunction with departAt, minDeviationDistance, or minDeviationTime. It cannot be used in calculateReachableRange requests.
1RouteDescriptor routeDescriptor = new RouteDescriptor.Builder()2 .considerTraffic(false)3 .build();45RouteCalculationDescriptor routeCalculationDescriptor = new RouteCalculationDescriptor.Builder()6 .routeDescription(routeDescriptor)7 .arriveAt(arrivalTime)8 .reportType(ReportType.EFFECTIVE_SETTINGS)9 .instructionType(InstructionsType.TEXT)10 .build();1112RouteSpecification routeSpecification = new RouteSpecification.Builder(13 routeConfig.getOrigin(),14 routeConfig.getDestination()15)16 .routeCalculationDescriptor(routeCalculationDescriptor)17 .build();