Route class overview
Stay organized with collections
Save and categorize content based on your preferences.
European Economic Area (EEA) developers
Introduction
The Route class provides the computeRoutes
method for returning 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.
Need Route Matrixes? If you are interested in a route matrix, see
Route Matrix class overview.
Migrating? If you are migrating from the Directions Service (Legacy)
to the Route
class, see
Migrate to the Route class.
Why use the Route class?
With the Route
class, with a wide range of route details you can
route your vehicles or packages according to your preferences while optimizing for cost and
quality.
What can you do with the Route class?
The computeRoutes
method returns the ideal route between two
locations. With the Routes library, you can do the following things:
- Get directions for different ways to travel:
- Modes of transportation: transit, driving, two-wheel vehicles,
walking, or bicycling.
- A series of waypoints that you can optimize for the most efficient
order in which to travel to them.
- Use multiple ways to specify origins, destinations, and waypoints:
- Text strings. For example: "Chicago, IL", "Darwin, NT, Australia", "1800
Amphitheatre Parkway, Mountain View, CA 94043", or "CWF6+FWX Mountain
View, California"
- Place instances
- Latitude and longitude coordinates, optionally with vehicle heading
- Fine-tune your route options based on your needs and goals:
- Select fuel or energy-efficient routes for your vehicle's engine type:
Diesel, Electric, Hybrid, Gas.
- Set fine-grained options for traffic calculation, letting you make
quality versus latency trade off decisions.
- Set vehicle heading (direction of travel) and side-of-road information
for waypoints to increase ETA accuracy.
- Specify pass-through versus terminal locations and safe stopover
locations.
- Request toll information, along with route distance and ETA.
- Control your latency and quality by requesting only the data you need
using a field mask, which helps you avoid unnecessary processing time and
higher request billing rates.
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 2025-09-08 UTC.
[null,null,["Last updated 2025-09-08 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[](/maps/documentation/javascript/routes/demo)\n\nIntroduction\n\nThe Route class provides the `computeRoutes` method for returning the ideal\nroute between two locations. Provide directions with real-time traffic for transit,\nbiking, driving, 2-wheel motorized vehicles, or walking between multiple locations.\n\n**Need Route Matrixes?** If you are interested in a route matrix, see\n[Route Matrix class overview](/maps/documentation/javascript/routes/route-matrix-class-overview).\n\n**Migrating?** If you are migrating from the Directions Service (Legacy)\nto the `Route` class, see\n[Migrate to the Route class](/maps/documentation/javascript/routes/routes-js-migration).\n\nWhy use the Route class?\n\nWith the `Route` class, with a wide range of route details you can\nroute your vehicles or packages according to your preferences while optimizing for cost and\nquality.\n\nWhat can you do with the Route class?\n\nThe `computeRoutes` method returns the ideal route between two\nlocations. With the Routes library, you can do the following things:\n\n- **Get directions for different ways to travel** :\n - Modes of transportation: transit, driving, two-wheel vehicles, walking, or bicycling.\n - A series of waypoints that you can optimize for the most efficient order in which to travel to them.\n- **Use multiple ways to specify origins, destinations, and waypoints** :\n - Text strings. For example: \"Chicago, IL\", \"Darwin, NT, Australia\", \"1800 Amphitheatre Parkway, Mountain View, CA 94043\", or \"CWF6+FWX Mountain View, California\"\n - Place instances\n - Latitude and longitude coordinates, optionally with vehicle heading\n- **Fine-tune your route options** based on your needs and goals:\n - Select fuel or energy-efficient routes for your vehicle's engine type: Diesel, Electric, Hybrid, Gas.\n - Set fine-grained options for traffic calculation, letting you make quality versus latency trade off decisions.\n - Set vehicle heading (direction of travel) and side-of-road information for waypoints to increase ETA accuracy.\n - Specify pass-through versus terminal locations and safe stopover locations.\n - Request toll information, along with route distance and ETA.\n- **Control your latency and quality** by requesting only the data you need using a field mask, which helps you avoid unnecessary processing time and higher request billing rates.\n\nNext steps\n\n- [Try the demo](/maps/documentation/javascript/routes/demo)\n- [Get started](/maps/documentation/javascript/routes/start)\n- [Get a route](/maps/documentation/routes/get-a-route)\n- [Reference documentation](/maps/documentation/javascript/reference/route)"]]