Style a single country
With the Mapbox Studio style editor, you can style a single country or region. In this example, you will be styling Australia.
Before getting started, you will need a few things:
- Mapbox account. You will need an account to log in and use the Mapbox Studio style editor. You can create an account at mapbox.com/account.
Log into your Mapbox account and navigate to your Styles page. This is where all your styles are listed. A style is a set of rules for how Mapbox will draw the map on a page. It includes references to your data, map images (icons, markers, patterns), fonts, and defines how all your data should be styled on your map. For more about styles, see the Styles section of the Mapbox Studio Manual.
To create a new style from your Styles page:
- Click New style.
- Scroll to the bottom of the list and select Blank, which lets you create a new style from scratch.
- Click Customize Blank. The style editor will automatically open.
Use the style editor to add the Mapbox Countries tileset and adjust the style of the country.
You can add Australia to the empty map canvas by using the country polygons from the Mapbox Countries tileset:
- In the Layers tab, click +.
- Click the Source drop-down menu to access the list of data sources. Search for
Mapbox Countriesin the Filter by name box or type
mapbox.country-boundaries-v1in the add tileset by ID finder.
- Select the
country_boundariespolygon layer in the Mapbox Countries tileset as the data source.
- Click on the shapes of various countries to understand the available data fields and values in the tileset
The Mapbox Countries tileset includes polygons for all countries of the world. To filter to use only Australia, add a filter for any of the unique data field values for Australia. We will use the English name name_en field for our filter.
- Click the Filter option and click + Create filter.
- Choose name_en from the list of data fields.
Australiainto the search bar. Click + Use Australia and then click Done.
- In the original panel, flip back to the Style tab.
- You'll see a black shape of Australia in your map canvas. Black is the default fill color.
Next, click the Style tab to customize the look and feel of the layer. Change both the Color and 1px stroke fields to
When you have finished editing your map style, publish your changes by clicking Publish in the upper right of the style editor. When you click the publish button, a window will display the difference between the previous and current version of this style. If you're happy with the changes, click Publish. Your style will now be available to share from a variety of tools and applications.
You've styled a single country with the help of an outside data source. Mapbox Studio provides a wide variety of ways to use your new map style. You can use this map directly on your website or in a web or mobile application. Take a look at the Publish style section of the Mapbox Studio Manual to see all the ways you can use your style!
You can extend the workflow outlined in this tutorial to add and style additional geometries in Mapbox Studio.
- Click Filter, then click the + Add another condition button.
- Select the name_en data field.
- Type in the name of the value or values you want to add. For this example, add the values
Papua New Guinea, and
Solomon Islandsto select those countries.
- After you have added all the country names, click the Done button.
- Click on the Style tab, then select Style with data conditions.
- Select the name_en data field. Type in the value
- Change the hex color value to
#6234df. Click the Done button.
- Click + Add another condition. Following the previous two steps, add a new hex color value for each of the other countries:
- Papua New Guinea:
#f056a1You can repeat this process using any filterable data from the tileset you are using.
Learn more about what you can do with the Mapbox Studio style editor in the Mapbox Studio Manual.