什麼是 Route Optimization API
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Route Optimization 是 Google 地圖平台 API,可為單一或多部車輛及其停靠站產生最佳化路線規劃。
使用 Route Optimization API 的好處
透過路線規劃提升運輸車隊的作業效率。根據成本、時間限制、顧客需求和任何其他業務目標調整路線。例如:
- 物流公司可以安排隔天出貨,同時最佳化運送作業,提高時間效率、節省成本、準時交貨,並提升司機和最終客戶的滿意度,進而節省時間和資源。
- 隨選外送公司可以選擇最適合接單的司機,將新訂單插入現有路線,加快派單流程並提高效率。
- 現場服務供應商可以指派供應商處理預約,並為多個預約找出最佳停靠順序,同時在發生問題時重新規劃最佳路線,藉此提升效率和顧客滿意度。
Route Optimization API 的用途
使用 Route Optimization API,根據您的目標和限制,為車隊規劃最佳路線和工作分配。
目標
|
限制
|
旅遊效率
|
使用距離和抵達目的地所需時間等參數,規劃最佳基本路線。
|
司機工作時間
|
根據駕駛員的工作時間和休息時間指派路線。
|
準時抵達
|
優先安排取貨、送貨或服務時間,確保在特定時間前完成。
|
車輛容量
|
根據車輛可載運的貨物量,將車輛指派給工作。
|
車輛使用成本
|
盡量減少執行工作所需的車輛數量。
|
時間範圍
|
在特定時間範圍內送達貨物或完成工作。
|
負載平衡
|
在車隊和人員之間公平分配工作。
|
依附元件和相容性
|
根據車輛類型、工作順序或貨運條件,最佳化車隊路線。
|
Route Optimization API 的運作方式
您可以使用 REST、gRPC 和用戶端程式庫存取 Route Optimization API。
要求主體
要求主體會接受有關貨運和可用於運送貨物的車輛資訊。包括以下詳細資料:
- 取貨和送貨地點
- 時間範圍
- 貨物尺寸和重量
- 車輛容量
回應主體
回應主體會提供詳細的路線規劃,包括:
如要進一步瞭解如何建構要求,請參閱「建構要求訊息」一文;如要瞭解如何解讀回應,請參閱「解讀回應」一文。
資源
下表摘要列出可透過 Route Optimization API 取得的資源,以及傳回的資料。
資料資源
|
說明和傳回的資料
|
傳回格式
|
optimizeTours
|
這個方法會傳回最佳化路線,並提供拜訪和指標的詳細資料。
|
JSON 或 gRPC proto
|
batchOptimizeTours
|
這個方法會傳回長時間執行作業的資源名稱,指出處理作業何時完成。
|
JSON 或 gRPC proto
|
如何使用 Route Optimization API
可用的用戶端程式庫
如要查看 Route Optimization API 適用的用戶端程式庫清單,請參閱用戶端程式庫。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-10 (世界標準時間)。
[null,null,["上次更新時間: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)"]]