Overview
Open Mobile Maps provides comprehensive styling capabilities for vector layers, polygons, lines, and other map elements. The SDK supports most of the Vector tiles standard and allows you to customize colors, patterns, and visual properties.Vector Layer Styling
Style JSON
Vector layers are styled using a style.json file that follows the Mapbox vector tiles standard:Style Expressions
The SDK’s style parser supports various expressions for dynamic styling:- Data expressions:
get,has,!has,in,!in - Comparison:
==,!=,<,<=,>,>= - Math operations:
-,+,/,*,%,^ - Logical:
all,any,! - Control flow:
case,match,coalesce - Type conversion:
to-string,to-boolean,to-number - Interpolation:
interpolate,step - Text formatting:
format,number-format,concat,length - Zoom-based:
zoom - State-based:
feature-state,global-state
Colors
Color Structure
Colors in Open Mobile Maps are represented with RGBA values (0.0 to 1.0 range):Color State List
Many elements support different colors for normal and highlighted states:Line Styling
Line Style Properties
Lines can be customized with extensive styling options:Line Style Parameters
| Parameter | Type | Description |
|---|---|---|
color | ColorStateList | Line color for normal and highlighted states |
gapColor | ColorStateList | Color for gaps in dashed lines |
opacity | float | Line opacity (0.0 - 1.0) |
blur | float | Blur amount applied to the line |
widthType | SizeType | SCREEN_PIXEL or MAP_UNIT |
width | float | Line width in specified units |
dashArray | float[] | Pattern for dashed lines (e.g., [4.0, 2.0]) |
dashFade | float | Fade distance for dash transitions |
dashAnimationSpeed | float | Speed of dash animation |
lineCap | LineCapType | BUTT, ROUND, or SQUARE |
lineJoin | LineJoinType | MITER, BEVEL, or ROUND |
offset | float | Perpendicular offset from line center |
dotted | boolean | Enable dotted line pattern |
dottedSkew | float | Skew angle for dotted pattern |
Polygon Styling
Polygon Style Properties
Polygons support fill color and opacity:Polygon Patterns
The SDK supports pattern fills for polygons through the polygon pattern tile system. Pattern textures can be applied to create textured polygon fills.Raster Shader Styling
Raster layers can be styled using shader-based effects:Best Practices
Performance Considerations
Performance Considerations
- Use
SCREEN_PIXELfor UI elements that should maintain consistent size - Use
MAP_UNITfor geographic features that should scale with the map - Limit the number of style variations to improve rendering performance
- Cache style objects when reusing the same style across multiple features
Color Selection
Color Selection
- Use RGBA values in the 0.0-1.0 range for consistency across platforms
- Consider accessibility when choosing color combinations
- Test colors under different lighting conditions
- Use alpha channel for transparency effects
Style Expressions
Style Expressions
- Use data-driven expressions for dynamic styling based on feature properties
- Leverage zoom expressions to change styles at different zoom levels
- Combine expressions using
caseandmatchfor complex logic - Test expression performance with large datasets
Related Topics
Layer Configuration
Configure tiled layer settings and zoom levels
Touch Handlers
Customize gesture handling and interactions