Route Matrix 类概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
简介
RouteMatrix
类可返回不同出发地和目的地位置之间的一系列路线的距离和行程时间。支持计算多个目的地之间的行程时间与距离,最多可包含 625 个路线元素。
需要行车路线?如果您对路线指引感兴趣,请使用 Route 类。
正在迁移?如果您要从距离矩阵服务(旧版)迁移到 RouteMatrix
类,请参阅迁移到路线矩阵类。
为何使用 RouteMatrix
类?
借助 RouteMatrix
类,您可以确定最有效的调度路线,例如:
- 如何以最佳方式分配一组工人来取一系列包裹
- 确定将包裹运送到最终目的地的最佳仓库
您可以使用 RouteMatrix
类做些什么?
借助 RouteMatrix
类,您可以获取多个起点和终点位置之间可能路线的矩阵。您可以在每个服务器端请求中指定多个出发地和目的地,其中出发地数量乘以目的地数量不得超过 625。
您可以请求以下类型的路线数据,以确定在多个起点和目的地之间安排乘客、货物或工作人员的最有效方式:
- 所选出行方式的距离(以公里或英里为单位)
- 交通状况下的预计行程时间
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):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)"]]