šŸ”‘

Obtaining Your Maps API Key(s)

šŸ” Home šŸ“– Chapter šŸ‘‰ Next
āš”Ā  GMapsBook.com is crafted by Jozef Sorocin (šŸŸ¢Ā Book a consulting hour) and powered by:
  • g-Xperts (Google Cloud & Business Profile Partner)
Ā 
Ā 
The Maps Platform runs on the Google Cloud Platform (GCP).
šŸ”‘
Roughly speaking, GCP is Googleā€™s answer to Amazonā€™s AWS and Microsoftā€™s Azure. But in terms of geospatial tooling, nothing comes close to Googleā€™s extensive offering.
Now, even if you only intend to use GCPā€™s map-related features, youā€™ll still need:
  • a GCP account
  • a GCP billing account
  • a GCP project
  • and a GCP Maps Key.
Thatā€™s a bunch of new terms so letā€™s visualize a typical, moderately complex scenario which will help us understand the moving parts.

Use case

I have a web application consisting of a frontend and a backend. I need two separate API keys ā€“ one to display a map on the frontend and another to run geospatial workloads from the backend.

Approach

From GCPā€™s point of view, the hierarchical architecture for the above scenario looks as follows:
ā†³ (user) account
	ā†³ billing account
    ā†³ project A
      ā†³ Frontend API key
			ā†³ Backend API key
      ā†³ Development/testing key (optional)
Each of these keys should have its own restrictions as discussed below. Also note that the whole project is associated with at most one billing account.

Account, Project, Billing Account

Assuming you already have a google account (e.g. a @gmail.com email or a company email running on Google Workspace):
  1. Visit console.cloud.google.com
  1. Click on the "Select a Project" dropdown in the top navbar and then click on "New Project".
  1. Give your project a name and click "Create".
  1. Wait for the project to be created. This may take a few minutes.
  1. If you donā€™t have a billing account, youā€™ll be prompted to create one. FYI, almost every new billing account gets $200 USD of monthly credit towards Maps usage.
Ā 

Generating a Maps API key

  1. In the Google Cloud Platform console, select your project from the dropdown in the top navigation bar.
  1. Click on the hamburger menu in the top-left corner and select "APIs & Services" > "Dashboard".
  1. Click on "Enable APIs and Services".
  1. Search for "Maps Javascript API" and click on it.
  1. Click the "Enable" button.

Already purchased? Sign in here.