The Routes API was released as a public Preview (pre-GA) in September of 2022. Pre-GA Offerings are covered by theGoogle Maps Platform Service Specific Terms. For more information, see thelaunch 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 locationin 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.
Thecompute routes responsenow contains the
geocodingResults
array. For every location in the request (origin, destination, or intermediate waypoint) that was specified as anaddress stringor as aPlus 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 arrayextraComputations
field to the request:
In the Preview release, you used afield maskto 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 settingextraComputations
:
travelAdvisory.tollInfo
(Toll info)
The following fields will no longer be included in
computeRoutes responses
unless explicitly enabled by settingextraComputations
:
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 receivetoll info,set the new
extraComputations
array field to"TOLLS"
.To receivefuel consumption,set the new
extraComputations
array field to"FUEL_CONSUMPTION"
.To receivetraffic information on polylines,set the new
extraComputations
array field to"TRAFFIC_ON_POLYLINE"
.