Stay organized with collections
Save and categorize content based on your preferences.
European Economic Area (EEA) developers
Compute Routes can return driving routes optimized for a shorter travel distance
when you enable shorter distance routes.
When you request a shorter distance route, the service returns the following:
The default route, which is a route optimized primarily for ETA.
A shorter route optimized for minimizing travel distance across the entire
trip.
What it is and why to use it
A shorter distance route prioritizes distance over driving comfort or speed. For
example, it may prefer local roads instead of highways, take dirt roads, or cut
through parking lots. It does not return any maneuvers that Google Maps knows to
be illegal.
Request a shorter distance route
Your request must meet the following criteria:
Set travelMode to DRIVE, BICYCLE, or TWO_WHEELER.
Set requestedReferenceRoutes to SHORTER_DISTANCE.
Set a response field mask to return the response properties associated with
a shorter-distance route:
routes.routeLabels: Identifies each route as either DEFAULT_ROUTE,
SHORTER_DISTANCE, or DEFAULT_ROUTE_ALTERNATE.
routes.routeToken: A route token that you can pass to the Navigation
SDK to
retrieve a custom route.
Don't include any Via intermediate waypoints.
Don't include the optimizeWaypointOrder parameter.
Optional: Set a response field mask to return the following properties
associated with both the default and shorter-distance route:
routes.distanceMeters: Returns the distance of the route.
routes.duration: Returns the duration of the route.
The following code shows a request for a shorter distance route. In this
example, you use the response field mask to return fields associated with both
the default and shorter-distance route with the following field masks:
Example response: Shorter distance and Fuel-efficient route
In this case, the shorter distance and the most fuel-efficient route are the
same, so that route is returned and the routeLabel is included for both types
of route.
Shorter distance routes are supported in all regions.
Billing
Google Maps Platform does not charge extra for the use of an experimental
feature. You will be charged based on your usage of the API based on other
parameters you set.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe Routes API now offers a "shorter distance route" option, which prioritizes minimizing travel distance over factors like speed or driving comfort.\u003c/p\u003e\n"],["\u003cp\u003eWhen requesting a shorter distance route, the API returns both the default route (optimized for ETA) and the shorter distance route.\u003c/p\u003e\n"],["\u003cp\u003eTo request a shorter distance route, users must set \u003ccode\u003etravelMode\u003c/code\u003e to \u003ccode\u003eDRIVE\u003c/code\u003e, \u003ccode\u003eBICYCLE\u003c/code\u003e, or \u003ccode\u003eTWO_WHEELER\u003c/code\u003e, \u003ccode\u003erequestedReferenceRoutes\u003c/code\u003e to \u003ccode\u003eSHORTER_DISTANCE\u003c/code\u003e, and include specific response field masks while excluding \u003ccode\u003eVia\u003c/code\u003e waypoints and the \u003ccode\u003eoptimizeWaypointOrder\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe shorter route may take unconventional paths, such as local or dirt roads and parking lots, as long as they are legal.\u003c/p\u003e\n"],["\u003cp\u003eUsing the shorter distance route feature in the API is supported across all regions and does not incur additional charges beyond the standard API usage fees.\u003c/p\u003e\n"]]],["The Routes API can return routes optimized for shorter distances, in addition to the default ETA-optimized route. To request this, set `travelMode` to `DRIVE`, `BICYCLE`, or `TWO_WHEELER`; `requestedReferenceRoutes` to `SHORTER_DISTANCE`; and specify response fields like `routes.distanceMeters`, `routes.duration`, `routes.routeLabels`, and `routes.routeToken`. Avoid using `Via` waypoints and `optimizeWaypointOrder`. The API will return a default route and a shorter-distance route, which may use local roads or dirt roads to minimize distance. This feature does not incur extra charges.\n"],null,["# Get a shorter distance route\n\n\u003cbr /\u003e\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\n\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\u003cbr /\u003e\n\nCompute Routes can return driving routes optimized for a shorter travel distance\nwhen you enable shorter distance routes.\n\nWhen you request a shorter distance route, the service returns the following:\n\n- The default route, which is a route optimized primarily for ETA.\n- A shorter route optimized for minimizing travel distance across the entire trip.\n\n| **Note:** The shorter distance route returned by Compute Routes is optimized for a shorter distance traveled across the trip.\n\nWhat it is and why to use it\n----------------------------\n\nA shorter distance route prioritizes distance over driving comfort or speed. For\nexample, it may prefer local roads instead of highways, take dirt roads, or cut\nthrough parking lots. It does not return any maneuvers that Google Maps knows to\nbe illegal.\n\nRequest a shorter distance route\n--------------------------------\n\nYour request must meet the following criteria:\n\n- Set `travelMode` to `DRIVE`, `BICYCLE`, or `TWO_WHEELER`.\n- Set `requestedReferenceRoutes` to `SHORTER_DISTANCE`.\n- Set a response field mask to return the response properties associated with a shorter-distance route:\n - `routes.routeLabels`: Identifies each route as either `DEFAULT_ROUTE`, `SHORTER_DISTANCE`, or `DEFAULT_ROUTE_ALTERNATE`.\n - `routes.routeToken`: A route token that you can pass to the [Navigation\n SDK](https://developers.google.com/maps/documentation/navigation) to retrieve a custom route.\n- **Don't include** any `Via` intermediate waypoints.\n- **Don't include** the `optimizeWaypointOrder` parameter.\n- *Optional* : Set a response field mask to return the following properties associated with both the default and shorter-distance route:\n - `routes.distanceMeters`: Returns the distance of the route.\n - `routes.duration`: Returns the duration of the route.\n\n| **Note:** Any request that doesn't meet these criteria returns an error.\n\nFor reference information, see\n[ReferenceRoute](https://developers.google.com/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#referenceroute)\nand\n[RouteLabel](https://developers.google.com/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#routelabel).\n\nExample request: Shorter distance route\n---------------------------------------\n\nThe following code shows a request for a shorter distance route. In this\nexample, you use the response field mask to return fields associated with both\nthe default and shorter-distance route with the following field masks:\n\n- `routes.distanceMeters`\n- `routes.duration`\n\n```json\ncurl -X POST -H 'content-type: application/json' -d '{\n \"origin\": {\n \"location\": {\n \"latLng\": {\n \"latitude\": 41.76904801292959,\n \"longitude\": -72.67374935684933\n }\n }\n },\n \"destination\": {\n \"location\": {\n \"latLng\": {\n \"latitude\": 41.823042361105024,\n \"longitude\": -71.40933143059424\n }\n }\n },\n \"travelMode\":\"DRIVE\",\n \"routingPreference\":\"TRAFFIC_AWARE\",\n \"requestedReferenceRoutes\": [\"SHORTER_DISTANCE\"],\n}' \\\n-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY \\\n-H 'X-Goog-FieldMask: routes.distanceMeters,routes.duration,routes.routeLabels,routes.routeToken' \\\n'https://routes.googleapis.com/directions/v2:computeRoutes'\n```\n\n### Example shorter route response\n\n {\n \"routes\": [\n {\n \"distanceMeters\": 138943,\n \"duration\": \"5373s\",\n \"routeToken\": \"CrsCCs4BMssBGq8BCkECFg9eN0MowaEI3Y4KqMEhzOTe-Qi3947kBsb8koUBkvX0oAKJ_b1S4uPoUvzzAYfXA92t_RXyw98Up6qKAaRaABIsNBjodKMdkMYAPMLMIajCwj-zsIxpgyBxOLYjdBBeKgkO3tFDDrj4YgZB5bMaFQAATME12CCCA9MEF-kO2wL_____DyoLHgAOAHN3DggAQQEyBAUBAQM9VDgqPkV88FI_SNO81oLq4JnjYyIXcklWWFo2cjhDZmltdk9NUDQ3aU1nUU0QBRpPCk0KGAoNCgIIAREAAAAAAIBmQBF56SYxqDm4QBISCAAQAxAGEBMQEhgCQgQaAggFIhsKF3JJVlhaLWFOQnZpbXZPTVA0N2lNZ1FNcAEoASIVAACBmRY1BjeCiUQewJGTrQ3DuHRp\",\n \"routeLabels\": [\n \"DEFAULT_ROUTE\"\n ]\n },\n {\n \"distanceMeters\": 112610,\n \"duration\": \"7165s\",\n \"routeToken\": \"CqgCCrsBMrgBGpwBCjYCFg1SN0MowaEI3Y4KjfqjF6Ls9BXc-QGiqCOpu7FDtfCXxSG2zLOGI_r4uQGc-we_nQ7MLAASLDQY6HSjHZDGg26EAFrPI5Q3NxvGA4ELazy3sLYqno_9eAFD2KxlCqAGQeWzGg4AAMQDGwyiAqwwKQggJCoLHgBsCQ8Acm0XWWcyAgQGPVQ4Kj5FfPBSP0jikPWC95WdhIwBIhdySVZYWjZHR0RiTzV2T01QOUpiQXlBTRAFGk8KTQoYCg0KAggCEQAAAAAAAFlAEU5iEFh5af1AEhIIABADEAYQExASGAJCBBoCCAUiGwoXcklWWFo3S09Cck81dk9NUDlKYkF5QU1wASgCIhUAAIGZFlj_CmMgGE6KGZcsE-tEywM\",\n \"routeLabels\": [\n \"SHORTER_DISTANCE\"\n ]\n }\n ]\n }\n\nExample request: Shorter distance and fuel efficient route\n----------------------------------------------------------\n\nThe following code shows a request for both a shorter distance route and a\nfuel-efficient route.\n\n\\` \n\n```json\n curl -X POST -d '{\n\"origin\": { \"location\": { \"latLng\": { \"latitude\": 41.76904801292959,\n\"longitude\": -72.67374935684933 } } }, \"destination\": { \"location\": {\n\"latLng\": { \"latitude\": 41.823042361105024, \"longitude\": -71.40933143059424 }\n } }, \"travelMode\":\"DRIVE\", \"routingPreference\":\"TRAFFIC_AWARE_OPTIMAL\",\n\"requestedReferenceRoutes\": [\"SHORTER_DISTANCE\", \"FUEL_EFFICIENT\"] }' \n\n-H 'Content-Type: application/json' \n\n-H 'X-Goog-Api-Key: YOUR_API_KEY' \n\n-H 'X-Goog-FieldMask:\nroutes.distanceMeters,routes.duration,routes.routeLabels,routes.routeToken' \n\n'https://routes.googleapis.com/directions/v2:computeRoutes'\n```\n\n\u003cbr /\u003e\n\n### Example response: Shorter distance and Fuel-efficient route\n\nIn this case, the shorter distance and the most fuel-efficient route are the\nsame, so that route is returned and the `routeLabel` is included for both types\nof route. \n\n```json\n{ \"routes\": [ { \"distanceMeters\": 138943, \"duration\": \"5375s\",\n\"routeToken\":\n\"Cr8CCs4BMssBGq8BCkECFg9eN0MowaEI3Y4KqMEhzOTe-Qi3947kBsb8koUBkvX0oAKJ_b1S4uPoUvzzAYfXA92t_RXyw98Up6qKAaRaABIsNBjodKMdkMYAPMLMIajCwj-zsIxpgyBxOLYjdBBeKgkO3tFDDrj4YgZB5bMaFQAATME12CCCA9MEF-kO2wL_____DyoLHgAOAHN3DggAQQEyBAUBAQM9VDgqPkV88FI_SNO81oLq4JnjYyIXS1laWFo4T19JcWVCM2ZFUDFMbms4UXcQBRpTClEKGAoNCgIIAREAAAAAAIBmQBFOYhBYGTy4QBIWCAAQAxAGEBMQEhgCQgQaAggFSgIIASIbChdLWVpYWjlpV0g2ZUIzZkVQMUxuazhRd3ABKAEiFQAAgZkW4Df4cspNNJZWlMZuUUxLPQ\",\n \"routeLabels\": [ \"DEFAULT_ROUTE\" ] }, { \"distanceMeters\": 112610,\n\"duration\": \"7156s\", \"routeToken\":\n\"CqwCCrsBMrgBGpwBCjYCFg1SN0MowaEI3Y4KjfqjF6Ls9BXc-QGiqCOpu7FDtfCXxSG2zLOGI_r4uQGc-we_nQ7MLAASLDQY6HSjHZDGg26EAFrPI5Q3NxvGA4ELazy3sLYqno_9eAFD2KxlCqAGQeWzGg4AAMQDGwyiAqwwKQggJCoLHgBsCQ8Acm0XWWcyAgQGPVQ4Kj5FfPBSP0jikPWC95WdhIwBIhdLWVpYWi1UNklfT055OVlQczhhcWlRSRAFGlMKUQoYCg0KAggCEQAAAAAAAFlAEU5iEFh5af1AEhYIABADEAYQExASGAJCBBoCCAVKAggBIhsKF0tZWlhaNERXSF9PTnk5WVBzOGFxaVFJcAEoAiIVAACBmRaESp2EJS5nmwiEF8KH15_f\",\n \"routeLabels\": [ \"FUEL_EFFICIENT\", \"SHORTER_DISTANCE\" ] } ] }\n```\n\nSupported regions\n-----------------\n\nShorter distance routes are supported in all regions.\n\n### Billing\n\nGoogle Maps Platform does not charge extra for the use of an experimental\nfeature. You will be charged based on your usage of the API based on other\nparameters you set.\n\n[Learn more about billing](https://developers.google.com/maps/documentation/routes/usage-and-billing)\nfor the Routes API."]]