Style JSON
You can provide a custom style using a JSON object or file:The
Style component allows you to override the base style URL with custom JSON. You can switch between different styles dynamically.Modify Existing Layers
Change the color of an existing layer in the base style:Custom GeoJSON Layer
Add custom shapes using GeoJSON:Gradient Line
Create a line with gradient colors:Data-Driven Styling
Use expressions to style features based on their properties:Mapbox Expressions
Mapbox expressions provide powerful data-driven styling:- Interpolate
- Match
- Case
- Step
Layer Types
Mapbox supports various layer types:| Layer | Use Case | Example |
|---|---|---|
FillLayer | Filled polygons | Countries, buildings, parks |
LineLayer | Lines and strokes | Roads, boundaries, routes |
CircleLayer | Circular points | Markers, data points |
SymbolLayer | Icons and text | POI markers, labels |
HeatmapLayer | Density visualization | Population density, activity heat |
FillExtrusionLayer | 3D buildings | Building heights, terrain |
RasterLayer | Raster tiles | Satellite imagery, weather data |
BackgroundLayer | Map background | Base color or pattern |
Common Style Properties
Tips
Mapbox expressions are evaluated on the GPU, making them extremely performant even with large datasets.
Source Code
View the complete examples on GitHub:Next Steps
Markers & Annotations
Add interactive markers to your map
Data Visualization
Visualize complex datasets