从预览版中迁移
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Routes API 于 2022 年 9 月发布为公开预览版(正式发布前的版本)。正式发布前的产品或功能受《Google Maps Platform 服务专用条款》约束。
如需了解详情,请参阅发布阶段说明。
本部分介绍了如何将应用从预览版迁移到正式版。
正式版中新增的功能
正式版新增了以下预览版中未包含的功能:
对现有预览版功能的更改
您现在必须通过向请求添加新的数组 extraComputations
字段,在正式版中明确启用以下功能:
在预览版中,您可以使用字段掩码来指定在响应中返回这些功能的信息。现在,您必须同时执行以下操作:
- 设置新的
extraComputations
数组请求参数以启用这些功能。
- 设置字段掩码以指定要在响应中返回的信息。
我需要注意什么?
除非通过设置 extraComputations
明确启用,否则 computeRouteMatrix 响应中将不再包含以下字段:
travelAdvisory.tollInfo
(过路费信息)
除非通过设置 extraComputations
明确启用,否则computeRoutes 响应中将不再包含以下字段:
routes.legs.travelAdvisory.tollInfo
(过路费信息)
routes.travelAdvisory.tollInfo
(过路费信息)
routes.travelAdvisory.fuelConsumptionMicroliters
(耗油量)
routes.travelAdvisory.speedReadingIntervals
(折线上的路况)
routes.legs.travelAdvisory.speedReadingIntervals
(折线上的路况)
我需要做什么?
如需接收有关通行费信息、燃油消耗量或折线上的路况的响应字段,您必须设置新的请求数组字段 extraComputations
,以包含以下一个或多个值:
如需接收过路费信息,请将新的 extraComputations
数组字段设置为 "TOLLS"
。
如需接收燃油消耗量,请将新的 extraComputations
数组字段设置为 "FUEL_CONSUMPTION"
。
如需接收多段线的路况信息,请将新的 extraComputations
数组字段设置为 "TRAFFIC_ON_POLYLINE"
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-22。
[null,null,["最后更新时间 (UTC):2025-07-22。"],[[["\u003cp\u003eThe Routes API has transitioned from Preview to General Availability (GA), introducing new features and changes to existing ones.\u003c/p\u003e\n"],["\u003cp\u003eYou can now specify locations using address strings and Plus Codes in addition to place IDs and coordinates.\u003c/p\u003e\n"],["\u003cp\u003eToll info, fuel consumption, and traffic on a polyline now require explicit enablement using the \u003ccode\u003eextraComputations\u003c/code\u003e field in requests.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egeocodingResults\u003c/code\u003e array has been added to the response, providing place IDs and metadata for locations specified as address strings or Plus Codes.\u003c/p\u003e\n"],["\u003cp\u003eExisting implementations relying on implicit inclusion of toll info, fuel consumption, or traffic on a polyline data need to be updated to utilize the \u003ccode\u003eextraComputations\u003c/code\u003e field.\u003c/p\u003e\n"]]],["The Routes API's GA release introduces new location specification options, including address strings and Plus Codes, and includes a `geocodingResults` array in the response. To enable toll info, fuel consumption, and traffic on a polyline, users must now set the `extraComputations` array in their requests. `extraComputations` values are \"TOLLS\", \"FUEL_CONSUMPTION\", and \"TRAFFIC_ON_POLYLINE\". The field mask must still be used. Certain fields will be omitted in the response unless enabled by `extraComputations`.\n"],null,[]]