[ Web Proxy ]
URL:
Viewing: https://developers.google.com/maps/optimization-guide [Back]  [Original]

Optimization Guide  |  Google Maps Platform  |  Google for Developers Skip to main content
Send feedback

Optimization Guide Stay organized with collections Save and categorize content based on your preferences.

outlined_flag

This guide describes several strategies to optimize your Google Maps APIs usage in terms of security, performance, and consumption.

Security

Reviewing security best practices

API keys are project-centric credentials that deserve the same precautions as user IDs and passwords. Review the API Security Best Practices to secure your keys from unintended use which could lead to undue quota usage and unexpected charges to your account.

Using API keys to access Maps APIs

API keys are the preferred authentication method for accessing Google Maps APIs. While using the client IDs is still supported, API keys support finer-grained security controls and can be tuned to work with specific web addresses, IP addresses, and mobile SDKs (Android and iOS). For information on creating and securing an API key, go to the "Using an API Key" page for each API or SDK. (For example, for the Maps JavaScript API, visit its page on Using an API Key.)

Performance

Using exponential backoff to handle errors

If your apps experience errors from excessive attempts to call an API within a short period of time, such as quota errors, consider using exponential backoff to let the requests process. Exponential backoff is most useful for errors in the 500s.

Specifically, adjust the pace of your queries. In your code, add a waiting period of S seconds between queries. If the query still results in a quota error, double the waiting period and then send another query. Continue adjusting the waiting period until the query returns without an error.

Sending user-interaction requests on demand

Requests to APIs that include user interaction should be sent only on demand. This means waiting for the end user to perform an action (such as on-click) to initiate the API request, then using the results to load a map, set a destination, or display appropriate information. Using an on-demand approach avoids unnecessary requests to the APIs, reducing API consumption.

Avoiding displaying overlay content when a map is moving

Avoid using Draw() to display custom overlay content on a map at the same time that a user might be moving the map. Since the map is redrawn every time a user moves the map, placing overlay content on the map at the same time can introduce lag or visual stuttering. Only add or remove overlay content from a map once the user stops panning or zooming.

Avoiding intensive operations in Draw methods

As a general rule, it is good practice to avoid performance-intensive non-drawing operations in a Draw() method. For example, avoid the following in your Draw() method code:

These operations can slow performance and introduce lag or visual stuttering when the map renders.

Using raster images for markers

Use raster images, such as images in .PNG or .JPG format, when adding markers to identify a location on a map. Avoid using Scalable Vector Graphics (SVG) images, since rendering SVG images can introduce lag when the map is redrawn.

Optimizing markers

Optimization enhances performance by rendering many markers as a single static element. This is useful in cases where a large number of markers is required. By default, the Maps JavaScript API will decide whether a marker will be optimized. When there is a large number of markers, the Maps JavaScript API will attempt to render markers with optimization. Not all Markers can be optimized; in some situations, the Maps JavaScript API may need to render Markers without optimization. Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered as a separate DOM element.

Creating clusters to manage marker display

To help manage the display of markers to identify locations on a map, create a marker cluster using the Marker Clusterer library. The Marker Clusterer library includes options for:

Consumption

For information on managing your Google Maps Platform costs, including creating budgets, modifying quotas, and setting alerts, see Manage costs.

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-19 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-19 UTC."],[],["Optimize Google Maps APIs usage by securing API keys, using them instead of client IDs, and implementing exponential backoff for errors. Enhance performance by sending requests on demand, avoiding overlays during map movement, using raster images for markers, and optimizing/clustering markers. Control consumption by setting budget alerts, capping daily usage, using static images when user interaction isn't needed, using the embed API for basic maps, and using mobile SDKs for mobile. In addition, you can reduce costs with optimized routing, limited waypoints, and cost-effective autocomplete and geocoding options.\n"]]

Web Proxy Viewer  |  New URL  |  Original Page