Get a Maps Demo Key: Try out select Maps JavaScript API and Places UI Kit features at no cost with a Maps Demo Key—no billing information required.

Overview

European Economic Area (EEA) developers

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

Route class

Directions on a map.

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

Distance matrix on a map.

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.

Next steps

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年09月01日 UTC.