Using Map IDs

Map IDs are identifiers you create in the Google Cloud Console, associate with a style, then put into your app code to apply that style to your map.

Upon creation, Map IDs are associated with a project, and are also restricted to a single platform (Android, iOS, JavaScript) or to the Maps Static API.

To create or manage any Map IDs in your Cloud Console, you must have the Project Owner or Project Editor IAM role.

Creating a Map ID

A Map ID is a unique identifier that represents a single instance of a Google Map. You can create Map IDs and update a style associated with a Map ID at any time in the Cloud Console.

To create a Map ID:

  1. In the Cloud Console, go to the Maps Management page.
  2. Select Create New Map ID to display the Create New Map ID form.
    Create New Map ID

    In the form, do the following:

    • Specify a map name.
    • Specify a map type or platform.
    • For JavaScript maps, choose raster or vector map type.
    • Enter a description of the map.
    • Select Next to display the new Map ID.

Associating a Map ID to a map style

These instructions assume that there is at least one existing map style in your project.

  1. In the Cloud Console, go to the Maps Management page.
  2. On this page, select an existing Map ID from the Map name column.
  3. At the bottom of this form, choose a map style from the Map styles associated with this Map ID dropdown.
  4. Select Save.
    Screenshot showing the details page for a single Map ID, including the dropdown field that lets users associate a map style with this Map ID.

Adding a Map ID to your app

Add your Map ID through a <fragment> element in the activity’s layout file, by using the MapView class, or programmatically using the GoogleMapOptions class.

For example, assume you created a Map ID that is stored as a string value named map_id in res/values/strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<string name="map_id">YOUR_MAP_ID</string>

For maps added through a <fragment> element in the activity’s layout file, all map fragments that should have the custom style must specify the Map ID in the map:mapId attribute:

<fragment xmlns:map=""
    map:mapId="@string/map_id" />

You can also use the map:mapId attribute of the MapView class to specify a Map ID:

    map:mapId="@string/map_id" />

To specify a Map ID programmatically, pass it to a MapFragment instance using the GoogleMapOptions class:


  MapFragment mapFragment = MapFragment.newInstance(
      new GoogleMapOptions()


  val mapFragment = MapFragment.newInstance(

In Android Studio, build and run your app as you normally would. Custom styles, as configured in the first step, will be applied to all maps with an ID.