2018-3Q: Map: Google Map API Key

Overview

Until recently Google allowed free access to their Map API. However, this has now changed and users need to set up a billing account and obtain an API key in order to continue using the Maps. The procedure below outlines how to set up a Google billing account and generate the required Maps API Key.

Pricing for the API calls can be found here:

https://developers.google.com/maps/billing/understanding-cost-of-use?hl=en_US#dynamic-maps

At time of writing the price was USD 0.007 per map load (USD 7 per 1000 map loads). Note when you set up a billing account, Google give a 1 Year / USD 300 free credit on your account. You need to supply credit card details, but these will not be charged until the free credit is exhausted.

Procedure

  • Login to your Google account that you wish to use for Billing / API.

  • Go to https://console.cloud.google.com If this is the first time you have used Google Cloud you will need to agree to Terms of Service:

    • Activate your Free Trial by clicking on the button on the top right hand corner. You will need to fill out the form and agree to Conditions to continue. On step 2 you need to enter the company name, address and billing details and finally click "Start my Free Trial":

  • From the menu on the top left and side select API & Services -> API -> Library and search for Map.

  • Click on "Maps JavaScript API" and click ENABLE.

  • In API & Services -> API -> Library search for Geocoding

  • Click on "Geocoding API" and click ENABLE

  • In API & Services -> API -> Library search for Places

  • Click on "Places" and click ENABLE

(Note the places API enables to ability to use the map search box)

  • From the menu on the top left and side select API & Services -> API -> Credentials

  • Select Create credentials -> API Key

  • Copy the generated API Key.

  • In SIMPLer go to Settings -> Modify WISP and paste the generated key into the "Google Map Key" field:

NOTE: The key in the image below is a sample key, this will not work, you will have to insert your own key that google generates for you.

In the Google Cloud Console API & Service Dashboard all map activity can be seen. it is also possible to set daily quotas on the number of API calls, allowed. etc.

Google quota

Securing your API key

It is important that you add in the url of your instance in the HTTP referrers section under your API key so it limits, from where the key can be used.

Example url: https://www.myserver.azotel.com/*

(this will allow utilisation of the api key on all SIMPLer pages on your instance)

NOTE: Replace myserver in the URL with your own server name.

Or USE: The general URL for restriction purposes *.azotel.com/*

Server Side Scripts

To be able to use server side scripts such as the tool that generates GPS coordinates from the customers address, you will need to generate a second google api key.

The servers IP address will also need to be added to the generated key whitelist, if you do not know the IP address of the server, you can email Azotel.

This second API key can then be inserted under wisp settings under the server side api key section