路線矩陣課程總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
簡介
RouteMatrix
類別會傳回不同起點和目的地之間路線矩陣的距離和交通時間。計算多個目的地之間的行程時間和距離,最多可包含 625 個路線元素。
需要行車路線嗎?如要取得路線指引,請使用 Route 類別。
要遷移嗎?如要從距離矩陣服務 (舊版) 遷移至 RouteMatrix
類別,請參閱「遷移至路線矩陣類別」。
為什麼要使用 RouteMatrix
類別?
您可以使用 RouteMatrix
類別,判斷最有效率的調度排程路線,例如:
- 如何指派一組工作人員領取一系列包裹
- 判斷最適合出貨的倉庫,將包裹運送至最終目的地
RouteMatrix
類別提供哪些功能?
使用 RouteMatrix
類別,您可以取得多個起點和終點之間可能的路線矩陣。每個伺服器端要求可指定多個出發地和目的地,出發地數量乘以目的地數量最多可達 625 個。
您可以要求這類路線資料,判斷在多個起點和目的地之間,為乘客、貨物或工作人員規劃路線的最有效方式:
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[],[],null,["**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\nIntroduction\n\nThe `RouteMatrix` class returns distances and travel times for a matrix\nof routes between different origin and destination locations. Calculate travel times and\ndistances for multiple destinations for up to 625 route elements.\n\n**Need Driving Routes?** If you are interested in route directions, use the\n[Route class](/maps/documentation/javascript/routes/route-class-overview).\n\n**Migrating?** If you are migrating from the Distance Matrix Service (Legacy)\nto the `RouteMatrix` class, see\n[Migrate to the Route Matrix class](/maps/documentation/javascript/routes/route-matrix-js-migration).\n\nWhy use the `RouteMatrix` class?\n\nWith the `RouteMatrix` class, you can determine the most efficient routes for dispatch\nscheduling, such as:\n\n- How best to assign a set of workers to pick up a series of packages\n- Determine the best warehouse from which to ship packages to their final destination\n\nWhat can you do with the `RouteMatrix` class?\n\nWith the `RouteMatrix` class, you can get a matrix of possible\nroutes between many start and end locations. You can specify multiple origins and\ndestinations per server-side request with the number of origins times the number of\ndestinations up to 625.\n\nYou can request these kinds of route data to determine the most efficient way to route\npassengers, shipments, or workers between multiple origins and destinations:\n\n- Distance in kilometers or miles for a selected travel mode\n- Estimated travel time in traffic\n\nNext steps\n\n- [Get started](/maps/documentation/javascript/routes/start)\n- [Get a route matrix](/maps/documentation/routes/get-route-matrix)"]]