OptionalbeforeLayerConfig?: GeometryBeforeLayerConfigLayer positioning configuration.
Controls where geometry layers appear in the map's layer stack. 'top' places them above every
layer but the module's own titles, a MapStyleLayerID below that style layer, and a
{ all, fill, line } record each part on its own.
Optionalcolor?: stringBase colour of the fill and the border, as a CSS colour string.
Precedence, highest first:
color property, fill.color,
fill.palette, this field.color property, fill.color,
fill.palette, this field.'#0A3653' on light map styles and '#5FA8D8' on dark.With fill.style: 'outline' the border ends its chain on a neutral grey instead of the accent or the default.
Optionalfill?: GeometryFillConfigThe interior colour and opacity of polygon geometries.
Optionalhighlight?: GeometryHighlightConfigHow a hovered or clicked geometry is drawn.
Optionallabel?: GeometryLabelConfigThe label at each geometry's center: its text and styling.
Optionallayers?: GeometryLayersConfigMapLibre overrides for the fill, border and label layers.
Optionalline?: GeometryLineConfigThe border, or outline, appearance of polygon geometries.
OptionallineLabel?: GeometryLineLabelConfigLabels along the polygon border lines, drawn only when this is set ({} for the defaults).
OptionaltransformFeaturesForDisplay?: (input: PolygonFeatures) => PolygonFeaturesTransform applied to features before rendering.
Receives the value passed to GeometriesModule.show and returns features ready for display. Useful for deriving labels or other display properties from domain data.
For most use cases the standard config fields (fill, label, line) suffice. Reachable
ranges have their own module, ReachableRangesModule, which titles and colours each band.
Optionalvisible?: booleanWhether the module draws its fills, borders, center labels and border labels.
show() and clear() never change it. A hidden module keeps its data until
GeometriesModule.setVisible shows it again. A layer hidden through its
layers entry's layout.visibility stays hidden while the
module is shown.
// Basic styling
const config: GeometriesModuleConfig = {
fill: { color: '#FF5733', opacity: 0.3 },
line: { color: '#C70039', width: 2 },
};
// One colour for fill and border
const brandConfig: GeometriesModuleConfig = { color: '#E63312' };
// With labels and positioning
const advancedConfig: GeometriesModuleConfig = {
fill: { color: 'blue', opacity: 0.25 },
line: { color: 'darkblue', width: 3 },
label: {
title: ['get', 'name']
},
beforeLayerConfig: 'lowestLabel' // Below map labels
};
// Data-driven styling
const dynamicConfig: GeometriesModuleConfig = {
fill: {
color: ['match', ['get', 'category'], 'park', '#4CAF50', 'water', '#2196F3', '#9E9E9E'],
opacity: 0.4
},
line: {
color: '#000000', width: ['case', ['get', 'highlighted'], 4, 2],
},
label: {
title: ['concat', ['get', 'name'], '\n', ['get', 'area'], ' km²']
}
};
GeometriesModuleSerializableConfig for the part that survives JSON.
Configuration options for the GeometriesModule.
Controls the visual appearance and positioning of polygon geometries displayed on the map.