Enable Google Basemaps

This documentation is for the CARTO Self-Hosted Legacy Version. Use only if you've installed this specific version. Explore our latest documentation for updated features.

CARTO Self-hosted can be configured to use Google Basemaps in the builder, allowing you to choose between different Basemap styles provided by Google. All you need is a Google Maps API key and a few simple configuration steps.

Generate Google Maps API key

The CARTO Self-hosted deployment needs a Google Maps Javascript API key in order to use Google Basemaps from Builder. You can follow these steps to generate a new key:

  1. Enable Google Maps JavaScript API:

    • In the Google Cloud Console, navigate to the APIs & Services section and go to the Library tab

    • Click on the Enable APIs & Services button

    • Search for Google Maps JavaScript API and enable it

  1. Create Credentials:

  • After enabling the API, navigate to Credentials tab

  • Click on Create Credentials and pick API key. Your new API key should appear as soon as it's generated!

  1. Copy Your API Key: This is the API Key that the CARTO Selfhosted instance will use to load the different Google Basemaps in Builder.

Ensure the security of your API key by applying a restrictive usage policy. After setting up your API key, consider configuring key restrictions such as restricting it to be used just for the Google Maps Javascript API or to enable the usage from your domain.

Single VM deployments (Docker Compose)

To enable Google Maps basemaps within CARTO Self Hosted, you need to have a Google Maps API key enabled for the Maps JavaScript API and set it via GOOGLE_MAPS_API_KEY in your customer.env file.

GOOGLE_MAPS_API_KEY=AIzaSyDkTNecQgCgw62pxxxxxxxxxxxx

Orchestrated container deployment (Kubernetes)

In order to enable Google Maps basemaps inside CARTO Self Hosted, you need to own a Google Maps API key and add one of the options below to your customizations file.

  • Option 1: Automatically create the secret

Automatically create a secret based on the plain text value specified in your customizations.yaml file.

  appSecrets:
  googleMapsApiKey:
    value: 
  • Option 2: Manually create a secret:

Create a secret running the command below, after replacing the <REDACTED> values with your key values:

  kubectl create secret generic \
  [-n my-namespace] \
  mycarto-google-maps-api-key \
  --from-literal=googleMapsApiKey=<REDACTED>

Add the following lines to your customizations.yaml, without replacing any value:

appSecrets:
  googleMapsApiKey:
    existingSecret:
      name: mycarto-google-maps-api-key
      key: googleMapsApiKey

Last updated