Cloud customization

Google Maps Platform offers Cloud-based maps styling features that make it easy to style, customize, and manage your maps using the Google Cloud Console, letting you improve the overall user experience of your maps. To make these features easy to adopt and manage, Cloud-based maps styling brings a number of new tools to the Cloud Console:

  • A style editor for easy style creation.
  • Map ID creation and management.
  • Custom map style creation and management.
  • Tools for dynamic updating of styles.

Adding a Map ID to your app

A Map ID is an identifier that's associated with a specific map style or feature. Configure a map style and associate it with a Map ID in the Google Cloud Console. Then, when you reference a Map ID in your code, its associated map style is displayed in your app. Any subsequent style updates you make appear in your app automatically, without the need for any updates by your customers.

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"?>
<resources>
<string name="map_id">YOUR_MAP_ID</string>
</resources>

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="http://schemas.android.com/apk/res-auto"
    class="com.google.android.gms.maps.SupportMapFragment"
    …
    map:mapId="@string/map_id" />

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

<com.google.android.gms.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    ....
    map:mapId="@string/map_id" />

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

Java


GoogleMapOptions options = new GoogleMapOptions()
    .mapId("YOUR_MAP_ID");
SupportMapFragment mapFragment = SupportMapFragment.newInstance(options);

      

Kotlin


val options = GoogleMapOptions()
  .mapId("YOUR_MAP_ID")
val mapFragment = SupportMapFragment.newInstance(options)

      

Or alternatively, pass it to a MapView instance:

Java


GoogleMapOptions options = new GoogleMapOptions()
    .mapId("YOUR_MAP_ID");
MapView mapView = new MapView(context, options);

      

Kotlin


val options = GoogleMapOptions()
    .mapId("YOUR_MAP_ID")
val mapView = MapView(context, options)

      

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

Using the maps style editor

The Maps Style editor is a GUI-based tool available in the Google Cloud Console.

Learn to use the Cloud-based map styling tool