Skip to main content

Function: createBoundaryGroup()

createBoundaryGroup(options): BoundaryGroup

Defined in: spec/boundaryGroup.ts:66

Creates a BoundaryGroup containing a single GeoJSON source and a line layer with sensible paint defaults.

Parameters

ParameterType
optionsCreateBoundaryGroupOptions

Returns

BoundaryGroup

A new BoundaryGroup ready to be used with appendBoundaryGroup or useBoundaryToggle.

Example

// URL — MapLibre fetches the GeoJSON internally
const states = createBoundaryGroup({
id: 'brazil-states',
data: 'https://example.com/estados.geojson',
});

// Inline GeoJSON
const districts = createBoundaryGroup({
id: 'sp-districts',
data: { type: 'FeatureCollection', features: [...] },
paint: { lineColor: '#ef4444', lineWidth: 2 },
});