By default, the route is optimized for travel time, the result is a fast route which prefers routes with longer distances, but lower travel times over routes with shorter distances at higher travel times. This default is represented by options[routingMode]=FAST and tuned to calculate practical routes a real driver would follow.
Set options[routingMode]=SHORT to obtain routes optimized for short distances, i.e. preferring routes with shorter distances, but higher travel times over routes with longer distances at lower travel times.
Use options[routingMode]=SHORTEST for an even more aggressive distance optimization. This can lead to significantly higher travel times if a route reduces the distance substantially (e.g., by taking smaller roads). This feature might be useful for accounting, cost calculations, and regulatory compliance, where the shortest theoretical route is required.
It is also possible to optimize the route for monetary costs based on distance, working time and toll costs. See the Monetary Costs concept.
All three routing modes—FAST
, SHORT
, and SHORTEST
—do not strictly calculate the absolutely fastest or shortest routes. The results remain meaningful and avoid excessive use of rural roads or travel through residential areas. When using SHORTEST
, the algorithm may take smaller roads more frequently to reduce route distance, but will still avoid invalid or obviously impractical roads whenever possible.
Limitations
The routing modes SHORT and SHORTEST do not consider truck routes, so the parameter vehicle[truckRoutes] will be ignored and a warning will be returned. For the profiles BICYCLE and PEDESTRIAN the routing modes are effectively the same, so options[routingMode] will be ignored and a warning will be returned.
When calculating SHORT or SHORTEST routes, it is not recommended to request alternative routes (results=ALTERNATIVE_ROUTES) or to use the options avoid and prefer turns on passenger side (options[avoid], options[preferTurnsOnPassengerSide]). The resulting routes may not be as expected.
Try it in the Short and Fast Routes code sample.