什么是 Route Optimization API
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Route Optimization 是一种 Google Maps Platform API,可为单辆或多辆车辆及其经停点生成优化后的路线方案。
为何使用 Route Optimization API
借助路线规划,您可以提高运输车队的运营效率。根据成本、时间限制、客户需求和任何其他业务目标调整路线。例如:
- 物流公司可以通过安排次日发货来节省时间和资源,同时优化配送,以提高时间效率、节省成本、确保按时送达,并提高司机和最终客户的满意度。
- 一家按需送餐公司可以选择最合适的空闲司机来接取新订单,并将其插入到现有路线中,从而使调度流程更快、更有效。
- 现场服务提供商可以通过以下方式提高效率和客户满意度:为预约分配提供商,为多个预约找到最佳停靠顺序,同时在出现问题时重新优化路线。
您可以使用 Route Optimization API 执行的操作
使用 Route Optimization API 可根据您自己的目标和限制条件优化车队的路线和任务分配。
目标
|
限制
|
出行效率
|
使用距离和到达目的地所需时间等参数优化基本出行路线。
|
司机工作时间
|
根据驾驶员的工作时间和休息时间为其分配路线。
|
准时到达
|
优先安排取件、送货或服务,以便在特定时间之前完成。
|
车辆容量
|
根据车辆的载货量为任务分配车辆。
|
车辆使用费
|
尽量减少执行任务所需的车辆数量。
|
时间窗口
|
在特定时间段内送达货物或完成任务。
|
负载均衡
|
在车队和人员之间公平分配任务。
|
依赖项和兼容性
|
根据车辆类型、任务顺序或货运条件优化车队路线。
|
Route Optimization API 的运作方式
您可以使用 REST、gRPC 和客户端库访问路线优化 API。
请求正文
请求正文接受有关您的货件和可用于配送货件的车辆的信息。这包括以下详细信息:
- 自提和配送地点
- 时间窗口
- 货件尺寸和重量
- 车辆容量
响应正文
响应正文会提供详细的路线规划,其中包括:
如需详细了解如何构建请求,请参阅构建请求消息;如需详细了解如何解读响应,请参阅解读响应。
资源
下表汇总了可通过路线优化 API 获取的资源及其返回的数据。
数据资源
|
说明和返回的数据
|
退货格式
|
optimizeTours
|
此方法会返回优化后的路线,其中包含访问和指标的详细信息。
|
JSON 或 gRPC proto
|
batchOptimizeTours
|
此方法会返回长时间运行的操作的资源名称,该名称指示处理何时完成。
|
JSON 或 gRPC proto
|
如何使用 Route Optimization API
可用的客户端库
如需查看适用于 Route Optimization API 的可用客户端库的列表,请参阅客户端库。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-10。
[null,null,["最后更新时间 (UTC):2025-08-10。"],[[["\u003cp\u003eRoute Optimization API leverages Google Maps data and custom parameters to generate efficient routes for fleets, considering factors like time, cost, and vehicle capacity.\u003c/p\u003e\n"],["\u003cp\u003eBusinesses like logistics companies, on-demand delivery services, and field service providers can use the API to automate dispatch, optimize delivery routes, and improve overall operational efficiency.\u003c/p\u003e\n"],["\u003cp\u003eThe API offers synchronous and asynchronous options for route calculation and provides detailed route plans with assigned tasks, vehicle routes, and performance metrics.\u003c/p\u003e\n"],["\u003cp\u003eUsers can define objectives such as travel efficiency, on-time arrival, and load balancing, along with constraints like driver work hours and vehicle capacity for tailored optimization.\u003c/p\u003e\n"],["\u003cp\u003eTo begin, set up a Google Cloud project, construct a basic request, and explore advanced scenarios to create customized route optimization solutions.\u003c/p\u003e\n"]]],["The Route Optimization API optimizes routes for single or multiple vehicles, enhancing operational efficiency. Users define business objectives (e.g., travel efficiency, on-time arrival) and constraints (e.g., driver hours, vehicle capacity) to guide the optimization. The API accepts shipment and vehicle details, such as locations, time windows, and capacity. It returns a detailed route plan with stop sequences and assigned shipments via JSON or gRPC. Users can construct requests and interpret responses using provided guidelines and resources.\n"],null,["# What is the Route Optimization API\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\nRoute Optimization is a Google Maps Platform API that generates optimized route\nplans for single or multiple vehicles and their stops.\n\nWhy use the Route Optimization API\n----------------------------------\n\nImprove the operational efficiency of your transportation fleet with the help of\nroute plans. Adjust your routes for cost, time constraints, customer needs, and\nany other business objective. For example:\n\n- A **logistics company** can save time and resources by scheduling next-day shipments while optimizing the deliveries for time efficiency, cost saving, on-time delivery, and driver and end customer satisfaction.\n- An **on-demand food delivery** company can make their dispatch process quicker and more effective by choosing the best active driver to pick up new orders and inserting them in their existing routes.\n- A **field service provider** can improve their efficiency and customer satisfaction by assigning providers to appointments and finding the optimal stop sequence for more than one appointment, all while re-optimizing routes when challenges come up.\n\nWhat you can do with the Route Optimization API\n-----------------------------------------------\n\nUse Route Optimization API to optimize your fleet's routes and tasks\nassignments based on your own *objectives* and\n*constraints*.\n\n- **Objectives:** Your business goals.\n- **Constraints:** The limitations of your physical assets.\n\n| Objectives || Constraints ||\n|-----------------------|--------------------------------------------------------------------------------------|------------------------------------|---------------------------------------------------------------------------------------------------|\n| **Travel efficiency** | Optimize basic travel routes using parameters like distance and time-to-destination. | **Drivers work hours** | Assign routes to drivers based on their work hours and breaks. |\n| **On-time arrival** | Prioritize a pickup, delivery, or service to arrive before a specific time. | **Vehicle capacity** | Assign a vehicle to a task based on the amount of load it can carry. |\n| **Vehicle use cost** | Minimize the number of vehicles required to perform a task. | **Time windows** | Have a shipment or task arrive in a specific time slot. |\n| **Load balancing** | Fairly distribute tasks across a fleet of vehicles and personnel. | **Dependencies and compatibility** | Optimize your fleet routes based on your types of vehicle, task sequence, or shipment conditions. |\n\nHow the Route Optimization API works\n------------------------------------\n\nThe Route Optimization API can be accessed using [REST](/maps/documentation/route-optimization/reference/rest/v1/operations), [gRPC](/maps/documentation/route-optimization/reference/rpc), and\n[client libraries](/maps/documentation/route-optimization/client-libraries).\n\n### Request body\n\nThe request body accepts information about your shipments and the vehicles\navailable to deliver them. This includes details such as:\n\n- Pickup and delivery locations\n- Time windows\n- Shipment size and weight\n- Vehicle capacity\n\n### Response body\n\nThe response body provides a detailed route plan which includes:\n\n- Sequence of stops\n- Assigned shipments\n- Overall metrics\n\nRead more details about constructing a request in [Construct a Request\nMessage](/maps/documentation/route-optimization/construct-request)\nand interpreting a response in [Interpret the\nResponse](/maps/documentation/route-optimization/interpret-response).\n\n### Resources\n\nThe following table summarizes the resources available through the\nRoute Optimization API along with the data it returns.\n\n| **Data resources** | **Description and data returned** | **Return format** |\n|----------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `optimizeTours` | This method returns an optimized route, with details of the visits and metrics. | [JSON](/maps/documentation/route-optimization/reference/rest/v1/projects/optimizeTours) or [gRPC proto](/maps/documentation/route-optimization/reference/rpc/google.maps.routeoptimization.v1#google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours) |\n| `batchOptimizeTours` | This method returns the resource name of a Long Running Operation, which indicates when processing is complete. | [JSON](/maps/documentation/route-optimization/reference/rest/v1/projects/batchOptimizeTours) or [gRPC proto](/maps/documentation/route-optimization/reference/rpc/google.maps.routeoptimization.v1#google.maps.routeoptimization.v1.RouteOptimization.BatchOptimizeTours) |\n\nHow to use the Route Optimization API\n-------------------------------------\n\n|---|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/route-optimization/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Run a basic request and receive a response** | After setup, start with sending a basic request and get the response, following [Construct a Request](/maps/documentation/route-optimization/construct-request) and [Interpret the Response](/maps/documentation/route-optimization/interpret-response). |\n| 3 | **Try a more advanced scenario and start creating your own request** | Explore example scenarios starting with [Pickup and Delivery Stop Order Optimization](/maps/documentation/route-optimization/pickup-delivery-order-optimization) and start building requests that match your use cases. |\n\n### Available client libraries\n\nFor a list of the available client libraries for Route Optimization API, see\n[Client Libraries](/maps/documentation/route-optimization/client-libraries).\n\nWhat's next\n-----------\n\n- **Start using the Route Optimization API** : Go to [Run a Basic Request](/maps/documentation/route-optimization/construct-request).\n- **Understand billing** : [Usage and Billing](/maps/documentation/route-optimization/usage-and-billing)\n- **See sample code and libraries** : [Client Libraries](/maps/documentation/route-optimization/client-libraries) and [Open Source](https://github.com/googleapis/google-cloud-java/tree/main/java-maps-routeoptimization).\n- **Follow best practices** : [Best Practices Using Route Optimization API Web\n Services](/maps/documentation/route-optimization/web-service-best-practices)"]]