Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
L'API Maps Static peut envoyer une erreur ou un avertissement en cas de problème
faux. Ce guide décrit chaque message d'erreur et fournit des informations
pour résoudre les erreurs.
Requêtes non valides
En cas de requête non valide, l'API Maps Static renvoie un code d'état HTTP 4xx et un message décrivant le problème. Vous trouverez ci-dessous quelques exemples de ces conditions d'erreur. Remarque: Il ne s'agit pas
une liste complète des erreurs possibles. Veuillez vérifier le code d'erreur et le message réels renvoyés par l'API pour en savoir plus sur les problèmes spécifiques.
Exemple de condition d'erreur
Code d'état
La requête inclut un paramètre non valide ou un paramètre obligatoire est manquant. Par exemple, le paramètre size ne se trouve pas dans la plage de valeurs numériques attendues ou est manquant dans la requête.
400 BAD REQUEST
La clé d'API incluse dans la requête n'est pas valide.
403 FORBIDDEN
Erreurs empêchant l'affichage d'une carte
Si la requête est valide, mais qu'une autre erreur empêche l'affichage de la carte, l'API Maps Static renvoie du texte ou une image d'erreur à la place de la carte, en fonction de l'erreur. Par exemple, lorsque l'application dépasse ses limites d'utilisation, une telle condition d'erreur se produit.
Figure: Image d'erreur affichée à la place d'une carte
Erreurs liées aux clés API et à la facturation
Si vous utilisez l'API Maps Static sans clé API ou si la facturation n'est pas activée dans votre compte, la page affiche une image d'erreur au lieu d'une carte, avec un lien indiquant le type d'erreur. Par exemple, "g.co/staticmaperror/key".
Erreurs liées à la clé sans contact et solutions
Vous utilisez l'API Maps Static sans clé API. À
vous devez:
Il manque une signature numérique dans votre demande (obligatoire). Pour résoudre ce problème,
Signer votre URL
Avertissements
Dans certaines conditions d'erreur, l'API renvoie une carte, mais certaines informations peuvent manquer. Lorsque cela se produit, deux conditions se produisent pour vous informer
l'avertissement.
Premièrement, la carte s'affiche, mais avec une barre d'erreur jaune superposée
en haut de la carte avec le texte "Erreur de carte: g.co/staticmaperror".
Ensuite, l'API renvoie un avertissement
sous la forme d'un en-tête HTTP nommé X-Staticmap-API-Warning.
Par exemple, l'URL suivante contient une valeur inattendue dans le paramètre markers :
Une erreur est survenue pendant la tentative de géocodage de la requête. Il y a
de nombreuses variantes de ce message, en fonction de l'élément où le geocoding
d'échec (centre, repère, visible ou tracé) et le nombre d'éléments
qui a échoué. X-Staticmap-API-Warning:Error geocoding: marker 1 est un exemple de cet avertissement, comme illustré dans l'exemple ci-dessus.
Too many geocoded markers requested (max is 15).
La requête spécifie plus de repères que le nombre maximal autorisé.
avec une adresse lisible. Le maximum est de 15. Notez que cette limite
s'applique uniquement aux repères spécifiés sous la forme d'une adresse lisible
nécessite un geocoding. Elle ne s'applique pas aux repères spécifiés avec des coordonnées de latitude/longitude.
Too many geocoded polyline vertices requested (max is 15).
La requête spécifie un nombre supérieur au nombre maximal autorisé de polylignes avec une adresse lisible par l'homme. Le maximum est de 15. Notez que cette limite
s'applique uniquement aux polylignes dont les sommets sont spécifiés en tant qu'adresses lisibles par l'homme qui
qui nécessitent un geocoding. Il ne s'applique pas aux polylignes spécifiées avec
de latitude et de longitude.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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."]]