Routes API
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
traffic.googleapis.com API。
服务:routes.googleapis.com
要调用此服务,我们建议您使用 Google 提供的客户端库。如果您的应用需要使用您自己的库来调用此服务,则在发出 API 请求时应使用以下信息。
发现文档
发现文档是用于说明和使用 REST API 的机器可读规范。它用于构建客户端库、IDE 插件以及与 Google API 交互的其他工具。一项服务可能会提供多个发现文档。此服务提供了以下发现文档:
服务端点
服务端点是指定 API 服务的网络地址的基本网址。一项服务可能有多个服务端点。此服务具有以下服务端点,下面的所有 URI 都与此服务端点相关:
https://routes.googleapis.com
REST 资源:v2
方法 |
computeRouteMatrix |
POST /distanceMatrix/v2:computeRouteMatrix
获取出发地和目的地列表,并返回一个数据流,其中包含每个出发地和目的地组合的路线信息。 |
computeRoutes |
POST /directions/v2:computeRoutes
根据一组终点和中间航点,返回主路线以及可选备选路线。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThe Routes API provides access to functionalities for calculating distances and routes using the Google Maps platform.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can interact with the API using Google-provided client libraries or by directly making RESTful API requests.\u003c/p\u003e\n"],["\u003cp\u003eTwo core methods offered are \u003ccode\u003ecomputeRouteMatrix\u003c/code\u003e for calculating distances between multiple origins and destinations, and \u003ccode\u003ecomputeRoutes\u003c/code\u003e for generating detailed route information.\u003c/p\u003e\n"],["\u003cp\u003eThe API utilizes a RESTful architecture and documentation is available through a discovery document.\u003c/p\u003e\n"],["\u003cp\u003eThe service endpoint for the Routes API is \u003ccode\u003ehttps://routes.googleapis.com\u003c/code\u003e.\u003c/p\u003e\n"]]],["The routes.googleapis.com API offers two primary methods: `computeRouteMatrix` and `computeRoutes`. `computeRouteMatrix` takes a list of origins and destinations, outputting route data for each combination. `computeRoutes` calculates the primary route and optional alternatives between specified waypoints. The service endpoint is `https://routes.googleapis.com`, and a discovery document is available at `https://routes.googleapis.com/$discovery/rest?version=v2` to facilitate building client tools. Google-provided client libraries are recommended.\n"],null,["# Routes API\n\nroutes.googleapis.com API.\n\n- [REST Resource: v2](#v2)\n\nService: routes.googleapis.com\n------------------------------\n\nTo call this service, we recommend that you use the Google-provided [client libraries](https://cloud.google.com/apis/docs/client-libraries-explained). If your application needs to use your own libraries to call this service, use the following information when you make the API requests.\n\n### Discovery document\n\nA [Discovery Document](https://developers.google.com/discovery/v1/reference/apis) is a machine-readable specification for describing and consuming REST APIs. It is used to build client libraries, IDE plugins, and other tools that interact with Google APIs. One service may provide multiple discovery documents. This service provides the following discovery document:\n\n- \u003chttps://routes.googleapis.com/$discovery/rest?version=v2\u003e\n\n### Service endpoint\n\nA [service endpoint](https://cloud.google.com/apis/design/glossary#api_service_endpoint) is a base URL that specifies the network address of an API service. One service might have multiple service endpoints. This service has the following service endpoint and all URIs below are relative to this service endpoint:\n\n- `https://routes.googleapis.com`\n\nREST Resource: [v2](/maps/documentation/routes/reference/rest/v2/TopLevel)\n--------------------------------------------------------------------------\n\n| Methods ||\n|------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [computeRouteMatrix](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRouteMatrix) | `POST /distanceMatrix/v2:computeRouteMatrix` Takes in a list of origins and destinations and returns a stream containing route information for each combination of origin and destination. |\n| [computeRoutes](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes) | `POST /directions/v2:computeRoutes` Returns the primary route along with optional alternate routes, given a set of terminal and intermediate waypoints. |"]]