Google Geocoding

Since June 2016, Google Maps requires a special Google Maps Geocoding server key to “translate” addresses into geographical locations (longitude/latitude) which is mandatory if you want to use Google Geocoding within Leaflet Maps Marker or Maps Marker Pro.

Terms of services

Google´s related Terms of Services can be found at https://developers.google.com/maps/terms.

Usage limits

If you enable Google as geocoding provider by adding your Google geocoding key, “Google Places API Web Service” (allowing up to 1.000 free requests/day) will be available for manual location search. If you enable pay-as-you-go billing by verifying your identity to Google with a credit card, up to 150.000 free requests/24-hour-period for manual location search are allowed – click here for more details. If you need an even higher quota, you need to purchase a Google Maps APIs Premium Plan license.

For the import feature and the Maps Marker APIs, “Google Maps Geocoding API” (allowing up to 2.500 free requests/day and a maximum of 50 requests/second) can be used. Once billing at Google has been enabled, you can exceed 2.500 requests/day and you will be billed by Google at 0.50 USD/1.000 additional requests, up to 100.000 daily. If you need an even higher quota, you need to purchase a Google Maps APIs Premium Plan license.

Tutorial: how to generate a Google geocoding key

This tutorial will show you how to create a Google Maps Geocoding API key (using this special server key has been supported since Maps Marker Pro v2.8/Leaflet Maps Marker v3.11).

We recommend to create a unique key for Google Geocoding only – even if you already registered a key for Google basemaps (as other best practises for securing your Google geocoding key against quota theft are needed, see below for details!) 

Prerequisite: you must have a Google account to generate a key for Google Maps Geocoding API.

  1. Go to the Google Geocoding API Console.
  2. Click ‘Get A Key’
    google-js-get-key
  3. Sign in with your Google Account (or create a new one first)
  4. a If you want to use an existing project, please select it from the list.
    b. Otherwise, select ‘Create a new project’, enter a project name and click on “Create an enable API”:
    google-js-create-enable-api
  5. Copy the generated key from the popup
    google-js-key-done
  6. Optional, but recommended to prevent quota theft: click on the link “API Console” below your API key and set an IP referrer for your key so that it can only be used on your domains.
    Do not set “HTTP referrers (web sites)” restrictions as it is recommended for Google basemaps, this will cause Google Geocoding API to break!
    – choose “IP addresses (web servers, cron jobs etc)” from “Key restrictions”
    – enter the IP address of your server to “Accept requests from these HTTP referrers (web sites)” (your hoster may assist you in providing the IP address or range of your server):
    google-js-ip-restriction
  7. Optional: Enable billing. See Usage Limits for more information.
  8. Log in on your WordPress Admin and navigate to Settings > Geocoding > Google Geocoding and  paste the server key you copied earlier into the “Google API server key” field:
    google-geocoding-enter-key-settings
  9. Click the “Save Changes” button at the end of the settings page.

If you also want Google Geocoding to be your default geocoding provider, please navigate to Settings / Geocoding / Geocoding provider and change the option “Main geocoding provider” accordingly.

Troubleshooting

If you have trouble translating addresses into geographical locations, please verify that the Google Maps Geocoding API is enabled in the Google Maps API Manager.


Reference for all Google Geocoding settings

google-geocoding-settings

Location Biasing

You may bias results to a specified circle by passing a location and a radius parameter. This instructs the Place Autocomplete service to prefer showing results within that circle. Results outside of the defined area may still be displayed. You can use the components parameter to filter results to show only those places within a specified country. If you would prefer to have no location bias, set the location to 0,0 and radius to 20000000 (20 thousand kilometers), to encompass the entire world.

language

The language in which to return results. See the list of supported domain languages. If you set a specific language at Settings / Google / “Google language localization”, that language will also be used for Google Geocoder. If no language is set, the current WordPress locale will be used.

region

Optional region code, specified as a ccTLD (“top-level domain”) two-character value. This parameter will only influence, not fully restrict, results from the geocoder. For more information see Region Biasing.

components

Optional component filters, separated by a pipe (|). Each component filter consists of a component:value pair and will fully restrict the results from the geocoder. For more information see Component Filtering.