The Routes API was released as a public Preview (pre-GA) in September of 2022. Pre-GA Offerings are covered by the Google Maps Platform Service Specific Terms. For more information, see the launch stage descriptions.
This section describes how to migrate an app from the Preview release to the GA release.
New features added to the GA release
The GA release adds the following new features that were not included in the Preview:
Along with place IDs and latitude/longitude coordinates, you can now specify a location in the GA release by using:
Address strings ("Chicago, IL" or "Darwin, NT, Australia")
Address strings are often how a user inputs an address. However, {product_name} must first geocode the address string internally to convert it to latitude/longitude coordinates before it can calculate a route.
In addition, support for the
regionCode
request parameter has been added, which lets you specify to return geocoded results for a specific geographic region.-
Plus Codes are like street addresses for people or places that don't have an actual address. Instead of addresses with street names and numbers, Plus Codes are based on latitude and longitude, and are displayed as numbers and letters.
The compute routes response now contains the
geocodingResults
array. For every location in the request (origin, destination, or intermediate waypoint) that was specified as an address string or as a Plus code, the API performs a place ID lookup. Each element of this array contains the place ID corresponding to a location along with additional metadata about the location. Locations in the request specified as a place ID or as latitude/longiiture coordinates are ignored.
Changes to existing Preview features
You must now explicitly enable the following features in the GA by
adding the new array extraComputations
field to the request:
In the Preview release, you used a field mask to specify to return information for these features in the response. Now, you must both:
- Set the new
extraComputations
array request parameter to enable these features. - Set a field mask to specify to return the information in the response.
What do I need to know?
The following fields will no longer be included in
computeRouteMatrix responses
unless explicitly enabled by setting extraComputations
:
travelAdvisory.tollInfo
(Toll info)
The following fields will no longer be included in
computeRoutes responses
unless explicitly enabled by setting extraComputations
:
routes.legs.travelAdvisory.tollInfo
(Toll info)routes.travelAdvisory.tollInfo
(Toll info)routes.travelAdvisory.fuelConsumptionMicroliters
(Fuel consumption)routes.travelAdvisory.speedReadingIntervals
(Traffic on a polyline)routes.legs.travelAdvisory.speedReadingIntervals
(Traffic on a polyline)
What do I need to do?
To receive the response fields for toll info, fuel consumption, or traffic on a
polyline, you must set the new request array field, extraComputations
, to
include one or more of the following values:
To receive toll info, set the new
extraComputations
array field to"TOLLS"
.To receive fuel consumption, set the new
extraComputations
array field to"FUEL_CONSUMPTION"
.To receive traffic information on polylines, set the new
extraComputations
array field to"TRAFFIC_ON_POLYLINE"
.