Custom routes
Planning a route may involve locations beyond the origin and destination. The route can be constructed as a custom route from a polyline (defined as a list of supporting points). This allows users to import routes from another source or reconstruct driven paths.
The supportingPoints parameter is used to reconstruct a route from an imported polyline:
- The sequence of supporting points provided is used as input for route reconstruction.
- Alternative routes are calculated between the origin and destination points specified in the base path parameter locations.
- If both
minDeviationDistanceandminDeviationTimeare set to zero, the origin and destination points are expected to be at, or very near, the beginning and end of the reference route. - The reference route may contain traffic incidents of the type
ROAD_CLOSURE, which are ignored when calculating travel time and traffic delays.
val supportingPoints = loadSupportingPointsFromFile()val amsterdam = GeoPoint(52.377956, 4.897070)val rotterdam = GeoPoint(51.926517, 4.462456)val routePlanningOptions = RoutePlanningOptions( itinerary = Itinerary(origin = amsterdam, destination = rotterdam), routeLegOptions = supportingPoints.map { RouteLegOptions(supportingPoints = it) },)Next steps
Since you have learned how to work with waypoints and supporting points, here are recommendations for the next steps: