The Routes Library, Maps JavaScript API includes the Route
and RouteMatrix
classes, which replace the legacy DirectionsService
and DistanceMatrixService
objects.
Route
class

The Route
class provides the computeRoutes()
method, which returns
the ideal route between two locations. Provide directions with real-time traffic for transit,
biking, driving, 2-wheel motorized vehicles, or walking between multiple locations.
RouteMatrix
class

The RouteMatrix
class returns distances and travel times for a matrix of routes
between different origin and destination locations. Calculate travel times and distances for
multiple destinations for up to 625 route elements.