Esegui la migrazione dalla versione di anteprima
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Sviluppatori dello Spazio economico europeo (SEE)
L'API Routes è stata rilasciata come anteprima pubblica (pre-GA) a settembre
2022. Le offerte pre-GA sono coperte dai Termini specifici di servizio di Google Maps Platform.
Per saperne di più, consulta le descrizioni della fase di lancio.
Questa sezione descrive come eseguire la migrazione di un'app dalla release di anteprima alla release GA.
Nuove funzionalità aggiunte alla release GA
La release GA aggiunge le seguenti nuove funzionalità non incluse nell'anteprima:
Oltre agli ID luogo e alle coordinate di latitudine/longitudine, ora puoi
specificare una località nella release GA utilizzando:
Stringhe di indirizzo ("Chicago, IL" o
"Darwin, NT, Australia")
Le stringhe di indirizzo sono spesso il modo in cui un utente inserisce un indirizzo. Tuttavia,
{product_name} deve prima geocodificare internamente la stringa dell'indirizzo per convertirla
in coordinate di latitudine/longitudine prima di poter calcolare un percorso.
Inoltre, è stato aggiunto il supporto per il parametro di richiesta regionCode
, che consente di specificare di restituire risultati geocodificati per una specifica regione geografica.
Plus Code
I plus code sono come gli indirizzi stradali per persone o luoghi che non
hanno un indirizzo vero e proprio. Invece di indirizzi con nomi e numeri di vie, i plus code sono basati su latitudine e longitudine e vengono visualizzati come numeri e lettere.
La risposta di calcolo delle route ora contiene l'array
geocodingResults
. Per ogni località nella richiesta (origine, destinazione o waypoint intermedio) specificata come stringa di indirizzo o come plus code, l'API esegue una ricerca dell'ID luogo. Ogni
elemento di questo array contiene l'ID luogo corrispondente a una località
insieme a metadati aggiuntivi sulla località. Le località nella richiesta
specificata come ID luogo o come coordinate di latitudine/longitudine vengono ignorate.
Modifiche alle funzionalità di anteprima esistenti
Ora devi attivare esplicitamente le seguenti funzionalità in GA aggiungendo il nuovo campo array extraComputations
alla richiesta:
Nella release di anteprima, hai utilizzato una maschera di campo per specificare di restituire le informazioni per queste funzionalità nella risposta. Ora dovete:
- Imposta il nuovo parametro di richiesta dell'array
extraComputations
per abilitare queste
funzionalità.
- Imposta una maschera di campo per specificare di restituire le informazioni nella risposta.
Che cosa devo sapere?
I seguenti campi non verranno più inclusi nelle
risposte computeRouteMatrix
a meno che non vengano attivati esplicitamente impostando extraComputations
:
travelAdvisory.tollInfo
(informazioni sui pedaggi)
I seguenti campi non saranno più inclusi nelle
risposte di computeRoutes
a meno che non siano attivati esplicitamente impostando extraComputations
:
routes.legs.travelAdvisory.tollInfo
(informazioni sui pedaggi)
routes.travelAdvisory.tollInfo
(informazioni sui pedaggi)
routes.travelAdvisory.fuelConsumptionMicroliters
(consumo di carburante)
routes.travelAdvisory.speedReadingIntervals
(traffico su una polilinea)
routes.legs.travelAdvisory.speedReadingIntervals
(traffico su una polilinea)
Che cosa devo fare?
Per ricevere i campi di risposta per le informazioni sui pedaggi, il consumo di carburante o il traffico su una polilinea, devi impostare il nuovo campo dell'array di richieste, extraComputations
, in modo che includa uno o più dei seguenti valori:
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-22 UTC.
[null,null,["Ultimo aggiornamento 2025-07-22 UTC."],[[["\u003cp\u003eThe Routes API has transitioned from Preview to General Availability (GA), introducing new features and changes to existing ones.\u003c/p\u003e\n"],["\u003cp\u003eYou can now specify locations using address strings and Plus Codes in addition to place IDs and coordinates.\u003c/p\u003e\n"],["\u003cp\u003eToll info, fuel consumption, and traffic on a polyline now require explicit enablement using the \u003ccode\u003eextraComputations\u003c/code\u003e field in requests.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egeocodingResults\u003c/code\u003e array has been added to the response, providing place IDs and metadata for locations specified as address strings or Plus Codes.\u003c/p\u003e\n"],["\u003cp\u003eExisting implementations relying on implicit inclusion of toll info, fuel consumption, or traffic on a polyline data need to be updated to utilize the \u003ccode\u003eextraComputations\u003c/code\u003e field.\u003c/p\u003e\n"]]],["The Routes API's GA release introduces new location specification options, including address strings and Plus Codes, and includes a `geocodingResults` array in the response. To enable toll info, fuel consumption, and traffic on a polyline, users must now set the `extraComputations` array in their requests. `extraComputations` values are \"TOLLS\", \"FUEL_CONSUMPTION\", and \"TRAFFIC_ON_POLYLINE\". The field mask must still be used. Certain fields will be omitted in the response unless enabled by `extraComputations`.\n"],null,["# Migrate from the Preview release\n\n**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\nThe Routes API was released as a public Preview (pre-GA) in September of\n2022. Pre-GA Offerings are covered by the [Google Maps Platform Service Specific\nTerms](https://cloud.google.com/maps-platform/terms/maps-service-terms).\nFor more information, see the [launch stage descriptions](/maps/launch-stages).\n\nThis section describes how to migrate an app from the Preview release to the GA\nrelease.\n\nNew features added to the GA release\n------------------------------------\n\nThe GA release adds the following new features that were not included in the\nPreview:\n\n- Along with place IDs and latitude/longitude coordinates, you can now\n [specify a location](/maps/documentation/routes/specify_location) in the GA release by using:\n\n - [Address strings](/maps/documentation/routes/specify_location#text_string) (\"Chicago, IL\" or\n \"Darwin, NT, Australia\")\n\n Address strings are often how a user inputs an address. However,\n {product_name} must first geocode the address string internally to convert\n it to latitude/longitude coordinates before it can calculate a route.\n\n In addition, support for the `regionCode` request parameter has been\n added, which lets you specify to return geocoded results for a specific\n geographic region.\n - [Plus Codes](/maps/documentation/routes/specify_location#plus_code)\n\n Plus Codes are like street addresses for people or places that don't\n have an actual address. Instead of addresses with street names and\n numbers, Plus Codes are based on latitude and longitude, and are\n displayed as numbers and letters.\n- The [compute routes response](/maps/documentation/routes/understand-route-response) now contains the\n `geocodingResults` array. For every location in the request (origin,\n destination, or intermediate waypoint) that was specified as an **address\n string** or as a **Plus code**, the API performs a place ID lookup. Each\n element of this array contains the place ID corresponding to a location\n along with additional metadata about the location. Locations in the request\n specified as a place ID or as latitude/longiiture coordinates are ignored.\n\nChanges to existing Preview features\n------------------------------------\n\nYou must now explicitly enable the following features in the GA by\nadding the new array `extraComputations` field to the request:\n\n- [Toll info](/maps/documentation/routes/calculate_toll_fees)\n\n- [Fuel consumption](/maps/documentation/routes/eco-routes)\n\n- [Traffic on a polyline](/maps/documentation/routes/traffic_on_polylines)\n\nIn the Preview release, you used a [field mask](/maps/documentation/routes/choose_fields) to specify to\nreturn information for these features in the response. Now, you must both:\n\n- Set the new `extraComputations` array request parameter to enable these features.\n- Set a field mask to specify to return the information in the response.\n\n### What do I need to know?\n\nThe following fields will no longer be included in\n[computeRouteMatrix responses](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRouteMatrix#response-body)\nunless explicitly enabled by setting `extraComputations`:\n\n- `travelAdvisory.tollInfo` (Toll info)\n\nThe following fields will no longer be included in\n[computeRoutes responses](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#response-body)\nunless explicitly enabled by setting `extraComputations`:\n\n- `routes.legs.travelAdvisory.tollInfo`(Toll info)\n- `routes.travelAdvisory.tollInfo`(Toll info)\n- `routes.travelAdvisory.fuelConsumptionMicroliters`(Fuel consumption)\n- `routes.travelAdvisory.speedReadingIntervals`(Traffic on a polyline)\n- `routes.legs.travelAdvisory.speedReadingIntervals`(Traffic on a polyline)\n\n### What do I need to do?\n\nTo receive the response fields for toll info, fuel consumption, or traffic on a\npolyline, you must set the new request array field, `extraComputations`, to\ninclude one or more of the following values:\n\n- To receive [toll info](/maps/documentation/routes/calculate_toll_fees), set the new\n `extraComputations` array field to `\"TOLLS\"`.\n\n- To receive [fuel consumption](/maps/documentation/routes/eco-routes), set the new `extraComputations`\n array field to `\"FUEL_CONSUMPTION\"`.\n\n- To receive [traffic information on polylines](/maps/documentation/routes/traffic_on_polylines), set the\n new `extraComputations` array field to `\"TRAFFIC_ON_POLYLINE\"`."]]