Most operations on Google Maps require that you tell Google who you are. To authenticate with Google Maps, follow the instructions for creating an API key. You will probably want to create a new project, then click on the Credentials section and create a Browser key. The API key is a string that starts with the letters AI.


You can pass this key to gmaps with the configure method:


Maps and layers created after the call to gmaps.configure will have access to the API key.

You should avoid hard-coding the API key into your Jupyter notebooks. You can use environment variables. Add the following line to your shell start-up file (probably ~/.profile or ~/.bashrc):


Make sure you don’t put spaces around the = sign. If you then open a new terminal window and type env at the command prompt, you should see that your API key. Start a new Jupyter notebook server in a new terminal, and type:

import os
import gmaps