Understand map style inheritance and hierarchy

When you customize a map style, it helps to understand how styling different mapfeatures may affect other styles on the map. There are several layers thatoverlap:

  • The base map: When you start creating a map style, the initialyou see is the style of the base map; that is, the default map. Any mapfeatures you don't customize retain the base map styling.

  • Map styles: Custom styles override the styles on the base map layer.In this image, the custom map style overrides the urban areas as aquaand roads as dark blue.

  • Style elements: Each map feature has one or more style elements thatyou can customize. In this image, the urban areas map feature polygonfill color is styled as aqua, and the road network fill coloris styled as blue.

    The base map with a map style overlay on top, showing the style elements of aqua urban areas and blue road networks

Map feature hierarchy

Within a map style, map features are organized hierarchically, with 4 broadmap features at the top, and all other map features arranged beneath them ina logical hierarchy. By default, a map feature inherits the element stylesfor the map feature above it in the hierarchy (its parent); however, youcan override the top level style by setting one or more of the style elementsfor map features underneath it (child map features). For details on the mapfeature hierarchy, seeWhat you can style on a map.

Each map feature has one or more elements, or parts of the map feature, thatyou can style. For example, the fill color for the polygon (the map featureshape) is an element, as is the stroke color for the text label. You styleeach element separately, and any element you don't style retains the defaultstyle. Since elements are separate, you can style the fill color for labeltext, and leave the stroke (outline) color as the default (or inheritingfrom a parent style).

Here are some helpful guidelines in understanding how style hierarchy andinheritance work.

Hierarchy and Inheritance Example

Here is an example of how inheritance and hierarchy works.

  1. Select the top-level map feature ofNatural, and set thePolygon Fill color to yellow. This styles all polygons for mapfeatures underNatural to be yellow:

    Map showing all Natural map features are yellow

  2. You wantLand cover, which is underNatural, to also be yellow,so you leave it unstyled, and it inherits the style fromNatural.

  3. You want forests to be green, so underLand cover, you openForest,and color its polygon green. This custom child style overrides thestyles forLand cover andNatural.

    Map showing forest map features are green

  4. You want ice to be shown a pale aqua, so also underLand cover, youopenIce, and color its polygon pale aqua.

    Map showing ice map features are pale aqua

  5. And last, you want water to be aqua, so you selectNatural>Water, andcolor its polygon aqua. Setting the child styleWater overrides the parentstyle forNatural.

    Map showing water map features are aqua

Follow a similar process to highlight the map features for your needs.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-01 UTC.