How to Create Google Maps API Key

December 24, 2021

How to Create Google Maps API Key

Before you start using the Maps Embed API, You need to create a project and enable a billing account.

Creating a Billing Account

 

If you have never used google cloud console to create google map API keys for your project then below are some easy steps to create a billing account:

Step 1:

Go to the Google Cloud Platform Console.

Step 2:

Click on the menu button to create billing account

Step 3:

Choose Billing option to set up your billing account.

Step 4: 

Set up your Billing account.

  • If this is your first billing account.
    • Click on Add billing account
    • Follow the remaining steps to set up your first billing account.
    • If you already have billing account.
      • Click on Billing Dropdown and choose Manage billing accounts. What’s more, you will see the list of current billing accounts projects.
      • Select Create account.
      • Follow the instruction for further process.

Notes:

Once you have created billing account and project you are qualified for Google Cloud Platform $300 free trial and Google Maps Platform recurring $200 monthly credit.

Subsequent Steps:

Once you are set up, you can start utilizing the Google Maps Platform APIs and SDKs. Learn how to create google map API key for your project.

How to create API keys?

 

Step 1:

Go to the Google Cloud Platform Console.

Step 2:

On Project selector page, click on Select a project dropdown and select or create your Google Cloud project for which you want to generate an API Key.

Step 3: 

Click the menu button and select APIs & Services > Credentials.

Step 4: 

On the Credentials page, click Create credentials > API key.

How to set an application restriction for API keys?

 

Step 1:

Once you are logged into the Google Cloud Platform, visit project selector page, click on Select a project dropdown and select or create your Google Cloud project for which you want to generate an API Key.

Step 2:

On the Credentials page, click the name of the API key that you want to secure.


Step 3:

On the Restrict and rename API key page, set the restrictions:

  • Under Key restrictions, select Application restrictions.
  • Select any one restriction type.

Step 4:

Click Save.

Below are short description about all restriction list.

Restriction TypeDescription
HTTP referrersAccept requests from the list of websites that you supply.

Below the types, specify one or more referrer web sites. Wildcard characters are acceptable for naming similar web sites. For example,
⦁ example.com
⦁ *.example.com/*
⦁ example.com/*

Adding a /* after the domain URL like example.com/* will make the request possible from any page within your website.
IP addressesAccept requests from the list of web server IP addresses that you supply.

Below the types, specify one IPv4 or IPv6 address or a subnet using CIDR notation (e.g. 192.168.0.0/22). If you need to enter another entry, a new box appears after you complete adding the previous entry.
Android appsAdd your package name and SHA-1 signing-certificate fingerprint to restrict usage to your Android app.

Below the types, add the SHA-1 signing-certificate fingerprints and your Android package name from your AndroidManifest.xml file.
iOS appsAccept requests from the iOS app with the bundle identifier that you supply.

Below the types, select the appropriate iOS bundle identifier from the list.
  

How to set an API restriction for API keys?

 

Step 1:

Visit the Credential Panel of GCP Console.

Step 2:

Select API key on which you want to set restriction

Step 3:

: Under API Restriction, Select Restrict key.

Step 4:

Click Select APIs Dropdown and choose APIs or SDKs which you want to restrict. You can select multiple APIs

Step 5:

Click Save.

In the event that your map is not showing and your browser console(press F12 and open console tab) shows the “Google Maps JavaScript API error: RefererNotAllowedMapError” it means the URL loading the Maps JavaScript API is not on the list of allowed referrers. Please check the referrer settings of your API key in the Google Cloud Platform Console.

In the event that your map is showing but browser console(press F12 and open console tab) shows the “Geocoding Service” API error it means the Geocoding API is not enable. You will need to enable the Geocoding API under APIs in the Google Cloud Platform Console to resolve this error. To do so please refer How to enable map APIs?

How to enable map APIs?

 

Step 1:

Visit the Google Cloud Platform Console.

Step 2:

From the projects list, select a project or create a new one.

Step 3:

Go to the API & Services > Dashboard and click on Enable API and Services at the top of the page.

 

These are the list of APIs.

Step 4:

Click on API which you want to enable for your project. If you need help finding the API, use the search field.

Step 5:

Click ENABLE.

Note:

Before creating API key, you must need to enable those APIs which all will be used into your project.

 

Use of Google Map APIs

  1. Map SDK for Android
    you can include maps based Google Maps information to your Android application
  2. Map SDK for IOS
    you can add maps based on Google maps data to your IOS application.
  3. Map JavaScript API
    you can customize maps with your own content and symbolism for display on web pages and mobile devices.
  4. Places API
    Get detailed information about 100 million places.
  5. Road API
    Snap GPS focuses to streets to distinguish the streets a vehicle was going along, compensating for GPS mistake.
  6. Direction API
    Directions between multiple locations.
  7. Distance Matrix API
    Travel time and distance for multiple destinations.
  8. Geocoding API
    Convert addresses into geographic directions (geocoding), which you can use to put markers or position the guide. This API likewise permits you to change over geographic directions into a location (invert geocoding).
  9. Maps Elevation API
    Query all locations on the surface of earth, including depth locations on the ocean floor (which return negative qualities), for rise information with the Maps Elevation API. Sampled requests are available for elevation data along ways, permitting elevation change count along routes
  10. Maps Embed API
    Make places easily discoverable with interactive Google Maps.
  11. Maps Static API
    Straightforward, embeddable guide picture with insignificant code.
  12. Playable Locations API
    Candidate areas for real-world games built with Maps.
  13. Semantic Tile API
    Google Maps geospatial information for Maps SDK for Unity
  14. Street View Publish API
    Distributes 360 photographs to Google Maps, alongside position, direction, and availability metadata. Applications can offer an interface for situating, associating, and transferring client produced Street View pictures.
  15. Street View Static API
    Implant a static (non-intuitive) Street View display or thumbnail into your page, without the utilization of JavaScript, utilizing the Street View API. The viewport is characterized with URL boundaries sent through a standard HTTP demand, and is returned as a static picture.
  16. Time Zone API
    Time region information for anywhere in the world.
RECENT POST