A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/maps/documentation/geocoding/geocoding-strategies below:

Optimizing Quota Usage When Geocoding | Geocoding API

Skip to main content Optimizing Quota Usage When Geocoding

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

Geocoding is the process of converting addresses ("1600 Amphitheatre Parkway, Mountain View, CA") to geographic coordinates (37.423021, -122.083739), which you can use to place markers or position the map. The Google Maps Platform APIs provide two approaches to geocoding:

Examples of client-side and server-side geocoding

Here is a sample of client-side geocoding which takes an address, geocodes it, moves the center of the map to that location, and adds a map marker there:

geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': address }, function(results, status) {
  if (status == google.maps.GeocoderStatus.OK) {
    map.setCenter(results[0].geometry.location);
    var marker = new google.maps.Marker({
      map: map,
      position: results[0].geometry.location
    });
  }
});

For more examples, see the Maps JavaScript API documentation.

Here is an example using Python to do a server-side geocoding request:

import urllib2

address="1600+Amphitheatre+Parkway,+Mountain+View,+CA"
key="my-key-here"
url="https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s" % (address, key)

response = urllib2.urlopen(url)

jsongeocode = response.read()

This produces a JSON object with the following content:

{
  "status": "OK",
  "results": [ {
    "types": street_address,
    "formatted_address": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
    "address_components": [ {
      "long_name": "1600",
      "short_name": "1600",
      "types": street_number
    }, {
      "long_name": "Amphitheatre Pkwy",
      "short_name": "Amphitheatre Pkwy",
      "types": route
    }, {
      "long_name": "Mountain View",
      "short_name": "Mountain View",
      "types": [ "locality", "political" ]
    }, {
      "long_name": "San Jose",
      "short_name": "San Jose",
      "types": [ "administrative_area_level_3", "political" ]
    }, {
      "long_name": "Santa Clara",
      "short_name": "Santa Clara",
      "types": [ "administrative_area_level_2", "political" ]
    }, {
      "long_name": "California",
      "short_name": "CA",
      "types": [ "administrative_area_level_1", "political" ]
    }, {
      "long_name": "United States",
      "short_name": "US",
      "types": [ "country", "political" ]
    }, {
      "long_name": "94043",
      "short_name": "94043",
      "types": postal_code
    } ],
    "geometry": {
      "location": {
        "lat": 37.4220323,
        "lng": -122.0845109
      },
      "location_type": "ROOFTOP",
      "viewport": {
        "southwest": {
          "lat": 37.4188847,
          "lng": -122.0876585
        },
        "northeast": {
          "lat": 37.4251799,
          "lng": -122.0813633
        }
      }
    }
  } ]
}

The server-side geocoder also provides an XML format as an alternative to JSON. For more examples, see the Geocoding API documentation and the client libraries for Python and other languages.

Quota and cost considerations

Geocoding costs, quotas, and rate limits drive the strategies outlined in this document.

Cost

Quota-per-day (QPD) limits are no longer in use for geocoding requests. Instead, each geocoding request, whether client-side through the browser or server-side through the Geocoding API web service, is billed at a per-each price. To manage your cost of use, consider capping your daily quota.

Important: To use the Google Maps Platform APIs, you must enable billing on each of your projects. If you choose not to add a billing account, your maps will be degraded, or other Maps API requests will return an error. Rate limits

The geocoding service is rate limited to 3,000 QPM (queries per minute), calculated as the sum of client-side and server-side queries.

When running client-side geocoding requests at periodic intervals, such as in a mobile app, your requests may return errors if all of your users are making requests at the same time (for example, all at the same second of every minute). To avoid this, consider one of the following:

Caching

See Geocoding API Policies about caching.

When to use client-side geocoding

The short answer is "almost always." The reasons are:

In particular, client-side geocoding is best when geocoding addresses based on input from the user.

There are two basic architectures for client-side geocoding:

When to use server-side geocoding

Server-side geocoding is best used for applications that require you to geocode addresses without input from a client. A common example is when you get a dataset that comes independently of user input, for instance if you have a fixed, finite, and known set of addresses that need geocoding. Server-side geocoding can also be useful as a backup for when client-side geocoding fails.

Some possible concerns are an unnecessary increase in latency for the user, and geocoding results of a lesser quality than client-side because less information is available in the request.

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 2025-08-14 UTC.

[[["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 2025-08-14 UTC."],[[["Geocoding transforms addresses into geographic coordinates for map placement, offered through client-side (browser-based) and server-side (HTTP) approaches by the Google Maps Platform."],["Client-side geocoding, ideal for user-input addresses, provides a faster experience and leverages user context for improved accuracy."],["Server-side geocoding is suitable for geocoding pre-defined address datasets or as a fallback when client-side geocoding fails."],["Google Maps Platform's geocoding service is rate limited to 3,000 queries per minute, and each request is billed individually."],["Consider caching, request staggering, or inexact repeating alarms to manage costs and avoid rate limits, especially in high-frequency scenarios."]]],["Geocoding converts addresses to geographic coordinates. Google Maps offers client-side (browser-based) and server-side (direct server queries) approaches. Client-side geocoding, preferred for user input, utilizes the Maps JavaScript API, as seen in the provided JavaScript example. Server-side geocoding, via the Geocoding API, is ideal for pre-existing datasets or as a client-side backup, and shown in the Python example that return a JSON format. Geocoding is rate-limited to 3,000 queries per minute and incurs a per-request cost.\n"]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4