Styles
The Mapbox Studio style editor is a tool for creating map styles. A style is a set of rules for how your map will be rendered on a page. It includes references to your data, map images (icons, markers, patterns), fonts, and, most importantly, it defines how all your data should be styled on your map.
Mapbox Studio topics covered in this section:
Upload
Dataset
Tileset
Template style
Custom style
Add data to style
Style data
Publish
What is a style?
A style is a JSON document that conforms to the Mapbox Style Specification. The style specification is designed especially for Mapbox GL JS (browser) and the Mapbox mobile SDKs (mobile) to read and understand so your map can be rendered on the page. The style controls almost everything about the map.
Style editor
The Mapbox Studio style editor allows you to create a custom style by editing components, adding layers, uploading custom icons, and publishing your style.
To open the style editor, click on the name of any style listed on your Styles page and it will open in the style editor.
Use the Layers panel on the left side of the style editor to edit the appearance of map features. For styles that use components, and editing interface appears to style many layers at once.
All changes made to your style will appear on the map canvas in the center of the style editor. You can click on the map to see all layers at a single point and when the Select data panel is open, you can inspect individual features from the selected tileset to view their properties. Read more about how the map canvas works below.
Use the toolbar along the top of the screen to adjust style settings, manage icons and fonts, export an image to print, and publish your style.
Publish
The Publish button in the upper right of the style editor allows you to save your style so you can use it in production applications.
Every change you make is tracked within Mapbox Studio, and saved as a draft version of your style. The changes will not show in any of your production applications until you click Publish. Updates can take up to 15 minutes to show on your live map.
For more information on draft vs. production styles, see Publish your style.
Components
We're phasing out components in favor of configuration options that was introduced with Mapbox GL JS v3 and Maps SDK v11. Configuration options can be declared by styles to customize its appearance and is used in the Mapbox Standard style to toggle the visibility of specific labels, adjust the lighting, or change the font. Read more about configuration options here and learn more about the Standard style here.
Components provide sensible defaults and quick opportunities for customization by optimizing the most common property changes for styles and packaging them into drop-down options, sliders, and toggles.
Components list
All components in the current style are under the layers list. While there are over a dozen components used throughout Mapbox template styles, the exact list of components will depend on the template style you are editing.
Managing components
There are several options for managing components at the top of the list, including:
- Add new layer: Click + to and choose a new component for your style.
- / Hide/show: Select the component in the list and click the icon to hide all features from the map. To show, click the icon.
- Delete layer or component: Select the component in the list and click the icon to permanently remove it.
- Eject component: Select a component in the list and right-click to see a context menu with the option to eject. When you eject a component, you are no longer able to edit the layers within that component as a single unit. After ejecting a component, the layers will continue to use the layer properties inherited from the initial component properties until they are manually edited. After the component is ejected, all the layers must be styled using layer properties directly. Once a component is ejected, it can't be reversed.
Edit component properties
To edit the style of map features in a component, click on the name of the component in the list. A panel listing the available component properties will open.
There are a few component properties for each component, and the properties available vary between components. A single component property can control multiple layer properties across several layers. Values for component properties are often defined using a toggle (on or off), a dropdown menu with a few options, or a slider with several options along a scale.
Unlike layer properties, component properties are not directly related to the Mapbox Style Specification and cannot be edited outside Mapbox Studio (at runtime).
Colors
The global Colors section displays colors used throughout the style. There are many component color properties you can define in Mapbox template styles. A component color property applies a single color to many features across components. Greenspace is an example of a component color property that applies to features in three different components (Point of interest labels, Walking, cycling, etc. and Land & water).
The color palette contains a list of possible component color properties. You can add and remove color properties in the color palette. After a color property is added to your palette, you can click on that list item to change its value. You can then select a new color on the color picker or define an RGBA, HSLA, or hex code.
Not every component color property has to be included in the color palette. If a component color property is not included in the color palette (no color is assigned), it will fall back to the color defined for the Base component color property, which can’t be removed. This means you will always have a well-coordinated palette without needing to choose a value for every possible component color property.
For example, if the color assigned to Base is purple and Greenspace is green, green parks will be on top of a purple base. If you remove Greenspace from the palette, your parks will turn a purple shade.
This is a pattern we use in our template styles. For example, the default color palette for Streets has 13 colors while Monochrome's default color palette has only 1 color.
Typography
The Typography section displays fonts and text styles used throughout your style. There are up to eight component typography properties you can define in Mapbox template styles. A component typography property applies font and text styles to features in one or more components. Minor cities is an example of a typography property that applies to a subset of features in the Place labels component.
You can define the font, set the text size, and transform the case (uppercase, lowercase) by clicking the item in the list to open a typography panel.
Ejecting
When you eject a component, you are no longer able to edit the layers within that component as a single unit. For example, ejecting the Road network component in the Mapbox Streets style would result in over 50 layers that need to be styled individually using layer properties.
After ejecting a component, the layers will continue to use the layer properties inherited from the initial component properties until they are manually edited. Going forward all layers must be edited using layer properties directly. Once a component is ejected, it can't be reversed.
Ejecting a component might be appropriate when you want to change many layer properties across many layers in the same component. It is also necessary when you want to reorder layers within a component or put a custom layer between layers within a single component.
You can reorder layer groups belonging to a data visualization component without ejecting the component.
Updating
To receive the latest features components offer, you will periodically receive updates to the components in your style. If your style has components older than the latest version available, you will see an update notification when you open Mapbox Studio. Once you view the available updates, you will see a list of changes to components and SDK compatibility since your last update. You can visually compare the current and updated versions of your style before proceeding with the update.
When ready, you have the option to update the original copy of your style or to save a copy with the updates.
Resolving conflicts
If there are any layer conflicts while updating your components, you will see a message in a popup on the lower right side of the screen that tells you what the conflicts are. Once the style has been updated, you will be able to address each conflict individually.
Once you have resolved any conflicts, your up-to-date style is ready to publish.
The Mapbox Studio style editor is a tool for creating map styles. A style is a set of rules for how your map will be rendered on a page. It includes references to your data, map images (icons, markers, patterns), fonts, and, most importantly, it defines how all your data should be styled on your map.
Mapbox Studio topics covered in this section:
Upload
Dataset
Tileset
Template style
Custom style
Add data to style
Style data
Publish
Layers
A layer is a styled representation of data of a single type (for example fill, line, or symbol). Layers can be a part of a component, but don’t have to be.
Layers power your map's visualization. Without layers, you cannot see your data. You can create multiple layers from the same data and you can filter data by attributes for styling in a layer. You can also fill the canvas with a color or pattern which will apply across the whole world.
You can always access the Layers list by clicking the Layers tab in the upper left of the style editor. There are several options for managing layers at the top of the list, including:
- Add new layer and choose "Custom layer…".
- Duplicate a layer to create a copy of an existing layer.
- Group or Ungroup layers to style them individually.
- Hide and Show layers.
CTRL + Z
in the current session, but this cannot be undone after you close your style.
Delete layer to permanently remove a layer.
You can undo this using - Reorder layers by clicking and dragging the next to each layer list item.
Add layer
There are a few options when you add a custom layer to your style: Source, Upload data, and Add tileset by ID.
These options allow you to add a layer that contains specific shapes (polygons, lines, or points) that cover part of the map. A layer from data comes from custom data that you have added to your Mapbox account. See the Geospatial data section for more information on adding custom data.
There is a limit of 15 unique sources permitted in styles saved in your Mapbox
account. This count includes Mapbox tilesets like Streets or Terrain. If you
reach the 15 source limit, you will see an error, Failed to update style
.
This limit is related to sources, not layers. To reduce the number of sources
needed, consider combining data before uploading and using filters in the
style editor to create different layers from the same source. For more
information on source limits see our Source limits in Mapbox Studio
styles
troubleshooting guide.
Source
The Source menu is the default option for adding a new layer to your map. Each layer needs data to work with, otherwise the style rules would not be applied to anything. To specify data for the layer, choose a source from the list of available tilesets used in your map style (Active sources), as well as a list of tilesets that are in your account but not used in the current style (Unused sources). You can use the search box to find a tileset.
Vector sources: If you select a vector source, you'll have the following options:
- Type: allows you to select the type of layer to create either fill, fill extrusion, line, circle, symbol, heatmap, or raster data types.
- Filter: allows you to limit features that are displayed in a layer based on data properties or geometry type.
- Zoom extent: sets the
min
(start) zoom andmax
(last) zoom to which you data is viewed on the map (learn more about manually adjusting zoom extents).
On the canvas, you will see a preview of your data. You can click to select and view the data on the map. Hover over the data to see what data subset is below and click the Select button to populate that data into the layer you are creating.
Raster sources: If you select a raster source, your layer will automatically be assigned the Raster type. The Zoom extent option will also be available to set the min
(start) zoom and max
(last) zoom to which you data is viewed on the map.
RBG-encoded DEM sources: If you select an RBG-encoded DEM source, your layer will automatically be assigned the Hillshade type. The Zoom extent option will also be available to set the min
(start) zoom and max
(last) zoom to which you data is viewed on the map.
Upload data
Upload a new tileset to use as a layer with the
Upload data option.Use the Upload file option in the upload menu to upload a MBTiles, KML, GPX, GeoJSON, Shapefile (zipped), or CSV file to convert it into vector tiles. To create raster tiles, you can upload a GeoTIFF file.
Using the Create from dataset option in the upload menu, you can select a dataset associated with your account and convert it into a tileset.