Apply conditional labels
- Label data: The data for airport labels comes from the
reffield contains short identifier codes for many airports, but not all airports. Read more about Mapbox Streets in the vector tile documentation.
- Override: In the Basic template style, the
airport-labellayer is controlled by a component. To make these changes, switch to Layers tab, find the
airport-labellayer, and use the Override button to customize the style of the
text-fieldfor this layer. Read more about overrides and components.
- Styling with expressions: In this example, the airport labels are styled using property expressions to style features using a data condition. Open the
airport-labellayer to see how to check whether a data property exists (in this case the
refproperty). If the property does exist, the label displays the full name (
name) along with the
ref. If the
refproperty does not exist, the label displays the
namevalue. Read more about styling with data conditions in the Mapbox Style Specification.
Was this page helpful?