Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Maps Static potrebbe generare un errore o un avviso in caso di problemi
sbagliato. Questa guida spiega ogni messaggio di errore e fornisce ulteriori istruzioni per la risoluzione degli errori.
Richieste non valide
Nel caso di una richiesta non valida, l'API Maps Static restituisce
un codice di stato HTTP 4xx e un messaggio che descrive
problema. Di seguito sono riportati alcuni esempi di queste condizioni di errore. Nota: non sono
un elenco completo dei possibili errori. Controlla il codice di errore e il messaggio effettivi restituiti dall'API per i dettagli di problemi specifici.
Esempio di condizione di errore
Codice di stato
La richiesta include un parametro non valido oppure un parametro obbligatorio è
mancante. Ad esempio, il parametro size non rientra nell'intervallo di valori numerici previsto o non è presente nella richiesta.
400 BAD REQUEST
La chiave API inclusa nella richiesta non è valida.
403 FORBIDDEN
Errori che impediscono la visualizzazione di una mappa
Se la richiesta è valida, ma si verifica un altro errore che impedisce alla mappa
visualizzato, l'API Maps Static restituisce del testo o un errore
anziché la mappa, a seconda dell'errore. Un esempio di una condizione di errore di questo tipo si verifica quando l'applicazione supera i suoi limiti di utilizzo.
Figura: un'immagine di errore visualizzata al posto di una mappa
Errori relativi alle chiavi API e alla fatturazione
Se utilizzi l'API Maps Static senza una chiave API o se utilizzi la fatturazione
non è abilitato nel tuo account, la pagina visualizza un'immagine di errore anziché
mappa, con un link che indica il tipo di errore. Ad esempio:
"g.co/staticmaperror/key".
Errori e soluzioni senza chiave
Stai utilizzando l'API Maps Static senza una chiave API. Per risolvere il problema, devi:
Nella tua richiesta manca una firma digitale (obbligatoria). Per risolvere il problema,
Firma l'URL
Avvisi
Per alcune condizioni di errore, l'API restituisce una mappa, ma alcune informazioni possono
non siano presenti sulla mappa. In questo caso, si verificano due condizioni per informarti dell'avviso.
Uno, la mappa viene visualizzata, ma con una barra di errore gialla sovrapposta alla parte superiore della mappa con il testo "Errore mappa: g.co/staticmaperror".
Due: l'API restituisce un avviso
sotto forma di intestazione HTTP denominata X-Staticmap-API-Warning.
Ad esempio, il seguente URL contiene un valore imprevisto nel campo
Parametro markers:
Si è verificato un errore durante il tentativo di geocodificare la richiesta. Esistono
molte varianti di questo messaggio, a seconda dell'elemento in cui il geocodifica
non è riuscita (centro, indicatore, visibile o percorso) e del numero di elementi
che non sono riusciti. Un esempio di questo avviso è
X-Staticmap-API-Warning:Error geocoding: marker 1, come показано показано nell'esempio riportato sopra.
Too many geocoded markers requested (max is 15).
La richiesta specifica un numero di indicatori superiore al massimo consentito
con un indirizzo leggibile. Il numero massimo è 15. Tieni presente che questo limite
si applica solo ai marker specificati come indirizzo leggibile da una persona che
richiede la geocodifica. Non si applica ai marker specificati con
coordinate di latitudine/longitudine.
Too many geocoded polyline vertices requested (max is 15).
La richiesta specifica un numero di polilinee superiori al massimo consentito
con un indirizzo leggibile. Il numero massimo è 15. Tieni presente che questo limite
si applica solo alle polilinee con vertici specificati come indirizzi leggibili da persone che
richiedono il geocodificazione. Non si applica alle polilinee specificate con
coordinate di latitudine/longitudine.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThe Maps Static API returns errors as HTTP status codes or warning messages for invalid requests, usage limits, or issues with API keys and billing.\u003c/p\u003e\n"],["\u003cp\u003eErrors that prevent map display can result in error images or text messages instead of the map, with details provided in the response.\u003c/p\u003e\n"],["\u003cp\u003eWarnings about potential issues, like geocoding problems or marker limits, are indicated by a yellow error bar on the map and HTTP header warnings.\u003c/p\u003e\n"],["\u003cp\u003eFor invalid requests, refer to the HTTP status code (e.g., 400, 403) and message for details about the specific issue.\u003c/p\u003e\n"],["\u003cp\u003eAlways check for HTTP header warnings and the yellow error bar to ensure your map is displayed correctly and address potential issues.\u003c/p\u003e\n"]]],[],null,["# Error Messages in Maps Static API\n\nThe Maps Static API may issue an error or warning when something goes\nwrong. This guide explains each error message, and provides further\ninstructions for resolving errors.\n\nInvalid requests\n----------------\n\nIn the case of an invalid request, the Maps Static API returns\nan HTTP `4xx` status code and a message describing the\nproblem. Below are examples of such error conditions. Note: This is not\na complete list of the possible errors. Please check the actual error code\nand message returned by the API for details of specific problems.\n\n| Example of error condition | Status code |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|\n| The request includes an invalid parameter, or a required parameter is missing. For example, the `size` parameter is not within the expected range of numeric values, or is missing from the request. | `400 BAD REQUEST` |\n| The API key included in the request is invalid. | `403 FORBIDDEN` |\n\nErrors that prevent a map from being displayed\n----------------------------------------------\n\nIf the request is valid, but another error occurs that prevents the map from\nbeing displayed, the Maps Static API returns either text or an error\nimage instead of the map, depending on the error. An example of such an error\ncondition is when the application exceeds its\n[usage limits](/maps/documentation/maps-static/usage-limits).\n\nFigure: An error image displayed instead of a map\n\n### Errors related to API keys and billing\n\nIf you use the Maps Static API without an API key, or if billing\nis not enabled on your account, the page displays an error image instead of a\nmap, with a link indicating the type of error. For example\n\"g.co/staticmaperror/key\".\n\n| Keyless errors and solutions ||\n|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | You are using the Maps Static API without an API key. To resolve, you must: 1. [Get an API key](/maps/documentation/maps-static/get-api-key#get-an-api-key) 2. [Enable billing](https://console.cloud.google.com/project/_/billing/enable?utm_source=Docs_BillingNudge) 3. [Sign your URL](/maps/documentation/maps-static/get-api-key#digital-signature) |\n| | Your request is missing a digital signature (required). To resolve, [Sign your URL](/maps/documentation/maps-static/get-api-key#digital-signature) |\n\nWarnings\n--------\n\nFor some error conditions, the API returns a map but some information may\nbe missing from the map. When this happens, two conditions occur to inform you of\nthe warning.\n\n- One, the map displays, but with a yellow error bar superimposed over top of the map with the text \"Map error: g.co/staticmaperror\".\n- Two, the API returns a warning in the form of an HTTP header named `X-Staticmap-API-Warning`.\n\nFor example, the following URL contains an unexpected value in the\n`markers` parameter: \n\n```\nhttps://maps.googleapis.com/maps/api/staticmap?center=Williamsburg,Brooklyn,NY&zoom=13&scale=1&size=400x400&markers=sdgaags&key=YOUR_API_KEY\n```\n\nThe API returns a map, but displays a yellow error bar superimposed\nover the image with \"Map error: g.co/staticmaperror\":\n\nThe API also returns the following HTTP header: \n\n```\nX-Staticmap-API-Warning:Error geocoding: marker 1\n```\n\nThe following table describes the warnings that the API may issue as HTTP\nheaders:\n\n| Warnings in `X-Staticmap-API-Warning` headers ||\n|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `Error geocoding: [center, ][marker #number, ][visible #num, ][path #num, ]*` | An error occurred while attempting to geocode the request. There are many variants of this message, depending on the element where geocoding failed (center, marker, visible, or path) and the number of elements that failed. One example of this warning is `X-Staticmap-API-Warning:Error geocoding: marker 1`, as shown in the above example. |\n| `Too many geocoded markers requested (max is 15).` | The request specifies more than the allowed maximum number of markers with a human readable address. The maximum is 15. Note that this limit applies only to markers specified as a human-readable address that requires geocoding. It does not apply to markers specified with latitude/longitude coordinates. |\n| `Too many geocoded polyline vertices requested (max is 15).` | The request specifies more than the allowed maximum number of polylines with a human readable address. The maximum is 15. Note that this limit applies only to polylines with vertices specified as human-readable addresses that require geocoding. It does not apply to polylines specified with latitude/longitude coordinates. |\n\nYou can see the HTTP header warnings in the\n[Chrome DevTools Console](/web/tools/chrome-devtools/console/console-write#errors_and_warnings), the\n[Firefox\nWeb Console](https://developer.mozilla.org/en-US/docs/Tools/Web_Console), or other equivalent tools in your browser.\n| **Note:** You should check for HTTP header warnings if you notice the yellow error bar on the map indicating that something may be missing from the map. It's also a good idea to check for warnings before launching a new application. Consider also whether user input or internationalization could lead to unexpected characters or malformed latitude/longitude coordinate specifications in the request."]]