Style layers
While Annotations provide a convenient way to add elements to a map, there may be cases where you want to add many elements or have greater control. In such cases, Style Layers offer a more performant approach to displaying these map elements.
Benefits:
- Style Layers are more efficient and performant, especially when dealing with a large number of features on the map from vector or GeoJSON sources.
- Style Layers offer extensive customization options, allowing developers to precisely control the appearance of map elements. This includes options such as the color, opacity, size and many other visual attributes listed in the Layers section of the Mapbox Style Spec.
Limitations:
- No default image available.
- Style Layers require a developer to learn specific Mapbox APIs and usage patterns associated with Layers. In contrast, Annotations use higher-level abstractions.
- Using the lower-level APIs of Style Layers may take more time, especially if you are new to the Maps SDK or mapping technologies.
- To achieve more sophisticated data-driven styling, developers will need to learn how to use
Mapbox Expressions
to control the appearance of map features based on the underlying data. This adds complexity to the development process.
Was this page helpful?