ภาพรวม
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Routes Library, Maps JavaScript API มีคลาส Route
และ RouteMatrix
ซึ่งแทนที่ออบเจ็กต์ DirectionsService
และ DistanceMatrixService
เดิม
Route
ชั้นเรียน
Route
คลาสมีเมธอด computeRoutes()
ซึ่งจะแสดงผล
เส้นทางที่เหมาะสมที่สุดระหว่าง 2 สถานที่ แสดงเส้นทางพร้อมสภาพการจราจรแบบเรียลไทม์สำหรับขนส่งสาธารณะ
การปั่นจักรยาน การขับรถยนต์ ยานพาหนะ 2 ล้อที่ใช้เครื่องยนต์ หรือการเดินระหว่างหลายสถานที่
RouteMatrix
ชั้นเรียน
คลาส RouteMatrix
จะแสดงผลระยะทางและเวลาในการเดินทางสำหรับเมทริกซ์ของเส้นทาง
ระหว่างสถานที่ต้นทางและปลายทางที่แตกต่างกัน คำนวณเวลาในการเดินทางและระยะทางสำหรับ
จุดหมายปลายทางหลายแห่งโดยมีองค์ประกอบเส้นทางได้สูงสุด 625 รายการ
ขั้นตอนถัดไป
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[],[],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\nThe Routes Library, Maps JavaScript API includes the `Route` and `RouteMatrix`\nclasses, which replace the legacy `DirectionsService` and `DistanceMatrixService`\nobjects.\n\n`Route` class\n\nThe `Route` class provides the `computeRoutes()` method, which returns\nthe ideal route between two locations. Provide directions with real-time traffic for transit,\nbiking, driving, 2-wheel motorized vehicles, or walking between multiple locations.\n\n- [Route class overview](/maps/documentation/javascript/routes/route-class-overview)\n- [Migrate to the new `Route` class](/maps/documentation/javascript/routes/routes-js-migration)\n- [Try the Routes library demo](/maps/documentation/javascript/routes/demo)\n\n`RouteMatrix` class\n\nThe `RouteMatrix` class returns distances and travel times for a matrix of routes\nbetween different origin and destination locations. Calculate travel times and distances for\nmultiple destinations for up to 625 route elements.\n\n- [Route matrix class overview](/maps/documentation/javascript/routes/route-matrix-class-overview)\n- [Migrate to the new `RouteMatrix` class](/maps/documentation/javascript/routes/route-matrix-js-migration)\n\nNext steps\n\n- [Get started](/maps/documentation/javascript/routes/start)"]]