[null,null,["最后更新时间 (UTC):2025-07-22。"],[[["\u003cp\u003eThe Routes Preferred API's \u003ccode\u003eComputeCustomRoutes\u003c/code\u003e method enables planning routes based on objectives beyond the fastest route, such as compliance or driver preferences.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eComputeCustomRoutes\u003c/code\u003e supports optimizing routes for \u003ccode\u003eDRIVE\u003c/code\u003e and \u003ccode\u003eTWO_WHEELER\u003c/code\u003e travel modes, but excludes intermediate waypoints and other travel modes.\u003c/p\u003e\n"],["\u003cp\u003eUsing the Routes Preferred API with the Navigation SDK provides the best route planning outcomes, though they can utilize separate cloud projects.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the \u003ccode\u003eComputeCustomRoutes\u003c/code\u003e method, enable it and verify your quota limits, requesting increases if necessary through Google Cloud Support.\u003c/p\u003e\n"],["\u003cp\u003eTo specify desired data in the response, use field masks with the \u003ccode\u003eComputeCustomRoutes\u003c/code\u003e method, selecting fields using dot-separated paths from the top-level response.\u003c/p\u003e\n"]]],["The Routes Preferred API's `ComputeCustomRoutes` method allows route planning by specifying a route objective and minimizing deviations from the operator's selected route. This method supports `DRIVE` and `TWO_WHEELER` travel modes, excluding `via` waypoints. To use it, enable the method and specify a response field mask via `$fields`, `fields`, or `X-Goog-FieldMask`. Quota limits should be monitored. Use alongside the Navigation SDK to maximize route planning benefits. Additionally, toll fees can be calculated using this API.\n"],null,["# Plan a Route\n\n\u003cbr /\u003e\n\n| This product or feature is in Preview (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\n| descriptions](/maps/launch-stages).\n\n\u003cbr /\u003e\n\nWhen you are determining the best route for a ridesharing trip, the\nfastest route may not always be the best option. You may want\nto plan your route.\n\nThe Routes Preferred API lets you plan a route by specifying\na route objective using the `ComputeCustomRoutes` method.\n\nThe `ComputeCustomRoutes` method can also help with route compliance by letting\nyou minimize the difference between the route selected by the operator and the\nroute driven.\n\nUse both the Routes Preferred API and the\n[Navigation SDK](https://developers.google.com/maps/documentation/navigation-sdk)\nto realize the full benefit of route planning.\n| **Note:** You do not have to use the same cloud project for the Routes Preferred API and the Navigation SDK.\n| **Note:** Unlike `ComputeRoutes` API, `ComputeCustomRoutes` only supports two travel modes, `DRIVE` (or the equivalent `TRAVEL_MODE_UNSPECIFIED`) and `TWO_WHEELER`. This method also does not support `via` intermediate waypoints. If you try to use other travel modes or `via` waypoints, the request fails. For more information about `via` waypoints, see [Routes Preferred API waypoints](/maps/documentation/routes_preferred/reference/rest/Shared.Types/Waypoint).\n\nEnable the ComputeCustomRoutes method\n-------------------------------------\n\nBefore you can use the `ComputeCustomRoutes` method in your code, you must\nenable it. For more information on enabling Routes Preferred API\nmethods, see [Getting Started](/maps/documentation/routes_preferred/get_started).\n| **Important:** Check your quota limits for Routes Preferred API methods. If you need to increase your quota limits, contact support by filing a case on the [Google Maps Platform support page](https://console.cloud.google.com/google/maps-apis/support) in the Google Cloud Console, or by calling the [Google Cloud Support Hotline](/maps/documentation/routes_preferred/support#support_hotline).\n\nUse the ComputeCustomRoutes method\n----------------------------------\n\nThe `ComputeCustomRoutes` method requires that you specify a response\nfield mask in the input. You can provide the response field mask by using\nthe URL parameter `$fields` or `fields`, or by using the HTTP/gRPC header\n`X-Goog-FieldMask`. For more information, see\n[System Parameters](https://cloud.google.com/apis/docs/system-parameters).\n\nThe field mask value is a comma-separated list of field paths. Each field path\nis a dot-separated list of field names that represent the message hierarchy.\nA field name is either the JSON object key, or the protobuf field tag name.\nThe field path starts from the top level response message type,\nand is optionally followed by one or more dots, and then the next level\nof field name. In general, field paths are constructed in the following way: \n\n```\ntopLevelField[.secondLevelField][.thirdLevelField][...]\n```\n\nA special case field mask is a wildcard \"\\*\", which selects all root-level\nfields.\n\nFor more information, see:\n\n- [**gRPC API reference**](/maps/documentation/routes_preferred/reference/rpc/google.maps.routes.v1)\n- [**REST API reference**](/maps/documentation/routes_preferred/reference/rest/v1/TopLevel/computeCustomRoutes)\n\nFor examples of using the `ComputeCustomRoutes` method, see\n[Computing a Custom Route (Beta) Examples](/maps/documentation/routes_preferred/custom_route_examples).\n\nCalculating toll fees\n---------------------\n\nFor information on calculating toll fees, see\n[Calculate toll fees](/maps/documentation/routes_preferred/calculate_toll_fees).\n\nFor examples of calculating toll fees, see\n[Computing a Custom Route Examples](/maps/documentation/routes_preferred/custom_route_examples#toll-fee-examples)."]]