Map Tips: Style maps like a wizard



Editor’s note: ‘Map Tips’ are designed to answer frequently asked questions about Google Maps APIs. For important tips on how to deploy Google’s mapping tools, read more from Ed Boiling, Google Maps Solution Architect at Google.

At Google, we understand that not everyone dreams in the same beautiful shades of orange and yellows of our Google Maps road network or the calm blues of Google Maps waterways. The reality is that our customers might want to make the water purple or their roads green. Sometimes you need a muted map with no labels to overlay your own data, or maybe you want the colors to match the branding of your website.

That’s why we offer Styled Maps. You can create the styles by hand and test your code to see how they look, or use our time saving visual tool — the Google Maps Style Wizard. The Google Maps Style Wizard allows you to select features and their elements, apply operations to those features, and save the styles to JSON, which you can copy and paste into your application.
Styled_map.png

With this simple JSON file, you can tailor that map to your needs—the color scheme of your website, a greyscale map to show details or to highlight a big event.

1. Select a type of feature to style in the Selectors panel. For any element type (e.g. roads, water) you can choose to style the shapes (select “Geometry”) or the text (Select “Labels”), or both. You can show a map of anywhere you wish as a preview.
Screen Shot 2015-09-07 at 11.56.33.png

2. To change the visibility, lightness or color, choose the combination of Stylers that match your needs. For example, to switch off all the map labels, select Feature type “All”, Element type “Labels” and check the box for the “Visibility” styler. Choose “Off” as the option for Visibility. To make all the water purple, select Feature type “water”, Element type “geometry” and select the “fill” option. Fill changes the solid color and stroke changes the line color. In the Stylers section choose the shade you want using the sliders or the hexadecimal value. For purple, either slide R to 204, G to 0 and B to 255 or enter #CC00FF in the text box.
Screen Shot 2015-09-07 at 11.58.19.png

3. Once you are happy with the styling of the feature type, click the Add button in the Map Style panel to save the style and create a new style to work on. Repeat Steps 2 to 5 to build up the set of styles for your map. Styles are applied in the order they are listed in the Map Style panel. To copy the style into your own Maps API map, click the Show JSON button to display the JSON object to pass to the style property of your MapOptions object. To generate an example map with this style using the Static Maps API, click the Static Map button.

4. Select a type of feature to style in the Selectors panel. For any element type (e.g. roads, water) you can choose to style the shapes (select “Geometry”) or the text (Select “Labels”), or both. You can show a map of anywhere you wish as a preview.
Screen Shot 2015-09-07 at 11.56.33.png

5. To change the visibility, lightness or color, choose the combination of Stylers that match your needs. For example, to switch off all the map labels, select Feature type “All”, Element type “Labels” and check the box for the “Visibility” styler. Choose “Off” as the option for Visibility. To make all the water purple, select Feature type “water”, Element type “geometry” and select the “fill” option. Fill changes the solid color and stroke changes the line color. In the Stylers section choose the shade you want using the sliders or the hexadecimal value. For purple, either slide R to 204, G to 0 and B to 255 or enter #CC00FF in the text box.
Screen Shot 2015-09-07 at 11.58.19.png

6. Once you are happy with the styling of the feature type, click the Add button in the Map Style panel to save the style and create a new style to work on. Repeat Steps 2 to 5 to build up the set of styles for your map. Styles are applied in the order they are listed in the Map Style panel. To copy the style into your own Maps API map, click the Show JSON button to display the JSON object to pass to the style property of your MapOptions object. To generate an example map with this style using the Static Maps API, click the Static Map button.

Here’s a complete example for a map with no labels and purple water.

[
  {
    "featureType": "water",
    "elementType": "geometry.fill",
    "stylers": [
      { "color": "#cc00ff" }
    ]
  },{
    "elementType": "labels",
    "stylers": [
      { "visibility": "off" }
    ]
  }
]

This style creates a muted grey scale map with just basic outlines that’s ideal for overlaying a data visualization using one of the many Maps API methods available.

[
  {
    "stylers": [
      { "visibility": "off" }
    ]
  },{
    "featureType": "landscape",
    "stylers": [
      { "visibility": "on" },
      { "color": "#e5e3df" }
    ]
  },{
    "featureType": "water",
    "elementType": "geometry",
    "stylers": [
      { "visibility": "on" },
      { "color": "#d4d4d4" }
    ]
  }
]
Screen Shot 2015-09-07 at 12.01.07.png

We hope you’re able to incorporate the Styled Maps capabilities into your website or application. Start customizing your maps today with the Google Maps Style Wizard. If you need some inspiration, visit our friends at snazzymaps.com to see a gallery of styled maps - you can start from any one of the hundreds of user uploaded Google Maps styles.