Layer Types
The SDK provides these layer components:- CircleLayer - Render points as circles
- SymbolLayer - Icons and text labels
- LineLayer - Stroked polylines
- FillLayer - Filled polygons
- FillExtrusionLayer - 3D extruded polygons
- RasterLayer - Raster images
- HillshadeLayer - Elevation shading
- HeatmapLayer - Point density visualization
- BackgroundLayer - Map background
- SkyLayer - Atmospheric sky
- ModelLayer - 3D models (v11)
Circle Layer
Render point features as circles.Basic Usage
Style Properties
| Property | Type | Description |
|---|---|---|
circleRadius | number | Circle radius in pixels |
circleColor | string | Fill color |
circleOpacity | number | Opacity (0-1) |
circleStrokeWidth | number | Stroke width in pixels |
circleStrokeColor | string | Stroke color |
circleStrokeOpacity | number | Stroke opacity (0-1) |
circleBlur | number | Blur effect |
Data-Driven Styling
Symbol Layer
Display icons and text labels.Text Labels
Icons
Icons and Text
Line Layer
Render polylines with various styles.Basic Lines
Line Patterns
Gradient Lines
Gradient lines require
lineMetrics: true on the ShapeSource.Fill Layer
Render filled polygons.Patterned Fills
Fill Extrusion Layer
Create 3D extruded polygons.Heatmap Layer
Visualize point density.Layer Ordering
Control layer stacking with positioning props:Layer Visibility
Control visibility with filters or zoom levels:Common Layer Props
All layers support these props:| Prop | Type | Description | ||
|---|---|---|---|---|
id | string | Unique layer identifier | ||
sourceID | string | ID of the source (auto-inferred from parent) | ||
sourceLayerID | string | Source layer for vector tiles | ||
aboveLayerID | string | Insert above this layer | ||
belowLayerID | string | Insert below this layer | ||
layerIndex | number | Insert at specific index | ||
filter | Expression | Filter features | ||
minZoomLevel | number | Minimum zoom to show layer | ||
maxZoomLevel | number | Maximum zoom to show layer | ||
slot | `‘bottom' | 'middle' | 'top’` | Layer slot (v11) |
Complete Example
Best Practices
- Use appropriate layer types: CircleLayer for points, LineLayer for routes, FillLayer for areas
- Order layers correctly: Background first, symbols last for proper rendering
- Set zoom constraints: Use
minZoomLevelandmaxZoomLevelto optimize performance - Filter features: Use filters to show only relevant data at each zoom level
- Reuse sources: Multiple layers can share the same source
Related
- Sources - Add data to the map
- Styling - Style specification reference
- Expressions - Data-driven styling