Styling Your Maps¶
Cloud Native GIS uses the Mapbox Style Specification for styling layers. The built-in Maputnik editor provides a visual interface for creating and editing styles.
Understanding Map Styles¶
A map style defines how layers are rendered, including:
- Colors: Fill, stroke, and text colors
- Sizes: Line widths, symbol sizes
- Typography: Font families, sizes, and placement
- Filters: Data-driven styling rules
- Zoom levels: Scale-dependent rendering
Maputnik Style Editor¶
Accessing Maputnik¶
- Go to Admin > Cloud Native GIS > Layers
- Click on a layer
- Click the Editor link in the layer detail view
Editor Interface¶
+------------------+------------------------+
| Layer List | |
| (Sources) | Map Preview |
+------------------+ |
| Style Layers | |
| (Rendering) | |
+------------------+------------------------+
| Property Editor |
+-------------------------------------------+
Creating a Style¶
- Select a layer from the sources panel
- Add a style layer for the data source
- Configure properties:
- Paint properties (visual appearance)
- Layout properties (positioning)
- Filter expressions (data selection)
- Preview your changes in real-time
- Save the style
Style Properties¶
Fill Layers (Polygons)¶
Line Layers¶
Symbol Layers (Points/Labels)¶
{
"icon-image": "marker",
"icon-size": 1.5,
"text-field": ["get", "name"],
"text-size": 12,
"text-color": "#333333"
}
Data-Driven Styling¶
Use expressions to style features based on their attributes:
Color by Category¶
{
"fill-color": [
"match",
["get", "type"],
"residential", "#ffcc00",
"commercial", "#0066ff",
"industrial", "#ff6600",
"#cccccc"
]
}
Size by Value¶
{
"circle-radius": [
"interpolate",
["linear"],
["get", "population"],
0, 5,
100000, 20,
1000000, 40
]
}
Zoom-Dependent Styling¶
Managing Styles¶
Style Storage¶
Styles are stored in the database and linked to layers. Each layer can have:
- One default style
- Multiple named style variants
Exporting Styles¶
- Open the layer in Maputnik
- Click Export in the menu
- Download as JSON
Importing Styles¶
- Open the layer in Maputnik
- Click Import
- Upload your JSON style file
Best Practices¶
- Start simple: Begin with basic colors, then add complexity
- Use zoom levels: Adjust detail based on zoom
- Consider accessibility: Use color-blind friendly palettes
- Test on different devices: Ensure styles work across screens
- Document your styles: Add comments and descriptions
Resources¶
- Mapbox Style Specification
- Maputnik Documentation
- Color Brewer - Cartographic color schemes