Ultimate guide to Google Maps

Petr Grochál
SUPERKODERS
Published in
12 min readSep 17, 2018

The Google Maps Platform switched to paid plans some time ago, specifically the pay-as-you-go model. Pricing and conditions have changed several times, but have stabilized and we can look at the whole situation in depth.

What are the limits for free use of Google Maps? How do I set up my maps? What are the alternatives? Can you optimize the number of API displays/calls? We will gradually find answers to all of these questions in this article.

We divided this article into three parts:

1. What is it all about?

2. How to set up my Google Maps Platform account

3. Google Maps don't work (for developers)

When will I have free maps?

If you have a simple map view of your point of interest (such as your company’s headquarters) on the web via iframe, you will still have Google Maps for free. Services that use the API key are charged.

Exploring pricing

Using Google Maps to a certain degree is free even if you use map viewing through API. Google will give you $200 credit each month from which you can utilize for API displays/calls. A $200 credit means that you can, for example, load 100,000 static maps, or 28,000 dynamic maps, etc. for free. A detailed table of pricing can be found here.

It has to be said that Google played with the price quite a bit and changed it several times. In one of the original plans, for example, they planned to display 25,000 dynamic maps per day for free, and every other 1000 would cost 50¢. Now, displaying the first 28,000 is free for the whole month, and the other 1000 costs $7. You can also calculate your estimated costs in the calculator here.

An additional $250

Non-profit organizations, media organizations, or startups can join the so-called public program and earn an additional $250 in credit every month. Just read this document.

The organization then completes the credit request form which Google then reviews.

What we pay for

How do I find out what I’m really paying for? You can find an overview of individual APIs used in APIs & Services. You can observe the use at different time intervals, the data is basically up to date, the delay is only a few minutes.

What does “Requests” mean from a developer’s perspective?

Maps JavaScript API

  • pay for every map on the page, that is, it is not about downloading an API, but about creating new maps and not counting the number of markers

Geocoding API

  • pay for each geocoding request from the address
  • It seems that the browser is caching if a geocoding API is called with the same address (you cannot rely on it, it can behave erratically)

Directions API

  • pay for each API directions request
  • it does not matter if it is the start and destination address or GPS location (no other Geocoding API request is counted)
  • it doesn’t depend on the number of waypoints

Account settings, services, and limits

Setting up your account properly is quite an important point. It’s good to be knowledgeable and know if you have any unnecessary services turned on, how to secure your API key, or how to set limits for using Google Maps.

Generating and setting API keys

Generating and setting keys can be done here Google Maps Platform. The whole process is described in point-form.

After going to the web, click on “Get Started”.

Clicking “Get started” opens a popup window. Tick the option “Maps” and then click “Continue”.

Fill in the project name (“My Project” is pre-filled), tick agree to Terms of Services and click “Next” to continue.

The application will then ask you to set your credit card details — click “Create billing account”.

You will now proceed through the steps setting up payment details. In the first step, you select a country, you can confirm updates, and again you must agree to the terms of use. Upon agreeing to the conditions, the button “Agree and continue” will be available to proceed to the next step.

In the next step it is necessary to fill in the details of the cardholder such as account type, name and address, payment method — thus card number and cardholder name. After completing all the necessary information, click “Start my free trial”.

If everything went successfully, the administration will display a message with the title “Enable Google Maps Platform” to activate the API key. Click the “Next” button.

Generating process — you will find your new API key in the grey box. Click “Done” to finish the process.

Setting

The key is generated, but there are still a few other things you need to set up, such as security, so that your key cannot be misused by anyone else, as well as budget settings so that no more than you can afford will be deducted.

Security

Now we have an API key generated. To avoid misuse, you need to set from where the key is allowed. This setting can be found in Google APIs.

Once inside administration, click “Credentials” in the left menu.

Here we see the newly created API key. To edit it, click the pencil icon.

Now you are in API key settings. Some adjustments need to be made.

First change the name of the key — as a general rule, it is named as the site name or project name

In “Key restrictions” you can find two tabs:

  • In “Application restrictions” select the option “HTTP referrers (web sites)” and enter the website name in the field. Use the format *.example.com/. The asterisk can be replaced by any string, that is, even for subdomains
  • In “API restrictions”, select services that are enabled for this API key

Save the settings by clicking the “Save” button.

Budget settings

In order for Google not to deduct more than you want, set your budget. In your case, set the budget so that you can use the $200 that Google offers for free.

In the menu Google Cloud Platform switch to Billing.

In the left menu, click “Budgets & alerts”.

To create a budget, click “Create budget”.

You will see a new editing window. Here, fill in the budget name, budget amount — i.e. $200 and do not forget to tick the “Include credit as a budget expense” option. If you do not tick this option, you will not be able to use your free credit. Finally, save everything by clicking the “Save” button.

Setting the service limit

Limits can also be set for individual services. To set a service limit, go to APIs & Services in the Google Cloud Platform and select the service you want to set the limit for.

In the details of the service, go to the tab “Quotas”.

Click the pencil icon to get to the settings.

And set the limit you need or tick “Unlimited” if you want to leave the service unlimited and save it by clicking the “Save” button.

Adding additional services under the API key

In Google Cloud Platform — APIs & Services, click on “ENABLE APIS AND SERVICES”.

On the new API library page, select the service you want to add and click on it.

You see details of the service and by clicking on the “Enable” button you add it.

Now you need to go to “Credentials” and add a service under the API key.

Select the key and click on it to edit.

And on the API restrictions tab, click Select API to select the service or services you want to add under the API key. Save everything by clicking the Save button.

Dashboard

The Dashboard itself is very simple and we are most interested in the total number of requests. From this figure you can determine if and how much you will pay. The cost of the services can be found on the calculator page — Pricing Calculator.

How to think about maps from the perspective of a backend developer

We often do not need maps, but we still use Google’s API to get GPS coordinates and further processing, whether it’s showing map points, determining the distance between GPS coordinates or simply displaying GPS coordinates an so on.

For this, the service server-side geocoding is used, which uses HTTP requests to directly request Google’s servers. Geocoding is the process of converting addresses (like “1600 Amphitheatre Parkway, Mountain View, CA”) into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers or position the map.

However, we can resolve such data processing by another API call using a different service. Alternatives for server side Google Geocoding are as follows:

Here Map — up to 250 thousand transactions per month free

MapBox, 50,000 requests per month free of charge (600 per minute)

Nominatim — tool using OpenStreetMap, free, limit: 1 request per second

Mapquest — free, 15,000 requests per month

Bing — offers about 10,000 requests per month for free

Google Maps Platform provided 2,500 requests per day for free until July 16, 2018. According to the new rules, we have 40,000 requests a month for free for Geocoding (about 1,300 per day) — consequently half less than before. Every 1,000 requests more costs $5.

Optimizing API Requests

Saving API requests can be done by building a cache. Practically it means calling APIs only for unknown addresses. It is important to save results for already found positions.

Another option is to call only valid requests for existing addresses. E.g. when an API is called for determining a location when a user has entered it directly, it is a good idea to check the data first whether it contains an address (validation of allowed characters, etc.).

Optimizing page view (front-end)

Maybe you first thought of generating multiple API keys. I have more subdomains or top-level domains for language mutations. But is it “legal” at all?

After long browsing of all conditions of use and discussions, we came to the conclusion that it is not. Google does not specifically specify use/domain. Everything is beautifully wrapped in the word “Project”, which in turn means a presentation in the same form, product or brand. It does not matter what domain your “Project” is running on, but whether the content is the same presentation.

Is it possible to save money?

The answer is not easy to generalize, because it depends on what exactly the presentation is used for. However, you can find a few uses that will reduce your costs.

  1. Beware of repeated geocoding addresses. As mentioned above, the request itself for getting GPS coordinates is a paid request. Avoid repeating requests as often as possible. It is best not to get them dynamically from the frontend, but get them as a group on a server and save them to a database.
  2. Consider the level of interactivity and use. Google maps offer so-called embedding maps for free. So if you do not need your own interactivity and appearance, it’s possible that this solution is enough for you.
  3. Another option is to use static maps. This is a service that generates a static image of Google Maps. In this case, custom styling can also be used. Static maps are charged, but the price is 3.5x smaller than dynamic maps.
  4. Almighty lazyload. The so-called lazyload technique can interestingly enough save on paid requests. First, you view a static printscreen of your map, and when the map is in the viewport or the mouse is on it, or the control button is activated, you load the dynamic map. This prevents unnecessary loading. For projects where the map is not the “main attraction” it can dramatically reduce your expenditure. The positive side effect of this solution will be to save data transfer and performance. Here’s a small demo:
Lazyloading demo

Google Maps Platform? No thanks

What can I do if I do not want to use Google Maps anymore? It is important to realize what you expect from the map and select a suitable replacement accordingly. And you do not have to worry, there are many alternatives. These include TomTom Maps, Esri, MapBox, HERE, Alk Maps, OpenStreetMap or the Czech Mapy.cz.

HERE maps

HERE has even recently published instructions on how to switch from Google Maps to HERE Dynamic Maps and introduced a new freemium plan. HERE dropped their original 90 day trial period, after which the user would lose all their advanced services. Unlike Google, you do not have to provide any credit card or other payment method for full functionality.

HERE maps

The Freemium Plan HERE is limited to 250,000 transactions per month, and when this limit is exceeded, $1 is charged for every 1,000 transactions.

One transaction means, in most cases, one API request, except for a few exceptions that are set in the terms. An overview of all features incl. documentation is available here.

ESRI

A similar move, like HERE, was made by Esri, covering advanced GIS systems like ArcGIS or ArcView. In August 2018, they published a series of four articles focusing on the transition from Google Maps to ArcGIS directly for developers who were affected by the new pricing model.

ArcGIS API for JavaScript offers data and visualization services in both 2D and 3D views, widgets for creating a user interface, searching, navigation, clustering, or client-side processing to create interactive applications using the latest browser technologies.

Special subscription plans are available for developers, 1 million transactions are free, but the definition of one transaction is different for ArcGIS.

MapBox

This service offers 50,000 transactions a month and also provides every 1,000 displays, geolocation requests or navigation requests each for 50¢.

Similar to the above-mentioned alternatives, MapBox can also use basic mapping functions such as map and user interface styling, 2D and 3D visualization, geocoding, navigation, clustering and other similar operations with data. It also offers advanced features such as creating and uploading custom data, converting map resources to game objects and environments for Unity, satellite data, or data visualization in Power BI.

MapBox 3D visualization

MapBox uses, for example, the applications Tinder Places, Facebook, Twittter or Lonely Planet.

MapBox is only a provider of online maps. Data comes from many sources, including open source data from OpenStreetMap or NASA. To integrate these underlying maps, MapBox uses its library MapBox.js.

Conclusion

There are a lot of theoretical things we have to deal with Google Maps Platform. If you want to have a look at a real case concerning the impact of Google Maps fees, you can look at this blogpost. The article is in Polish, but with some help from Google translator we think you will be able to understand it.

--

--