Context object providing access to configuration, state, and services. This object is passed to various callbacks and components throughout the application.
Type: Object
Application configuration passed to the InteractiveMap constructor.
Type: Object
Current application state, including:
{
breakpoint: 'mobile' | 'tablet' | 'desktop',
interfaceType: 'mouse' | 'touch' | 'keyboard',
// ... other app state
}Type: Object
Registry of icons available for use in buttons and controls.
Type: MapProvider
The map provider instance. Provides methods to interact with the underlying map engine.
// Example usage
const center = context.mapProvider.getCenter()
context.mapProvider.setView({ zoom: 10 })Rasterises and registers pattern fill images with the map engine. Plugin layer adapters call this instead of importing provider internals directly, keeping cross-package boundaries clean.
patternConfigs— flat array of dataset/sublayer configs that have afillPatternorfillPatternSvgContentproperty (sublayer merging is the caller's responsibility)mapStyleId— current map style IDpatternRegistry— the core pattern registry instance
// In a plugin's MapLibre layer adapter
await mapProvider.registerPatterns(getPatternConfigs(datasets, patternRegistry), mapStyleId, patternRegistry)Rasterises and registers symbol images with the map engine. Plugin layer adapters call this instead of importing provider internals directly, keeping cross-package boundaries clean.
symbolConfigs— flat array of dataset/sublayer configs that have asymbolproperty (sublayer merging is the caller's responsibility — usegetSymbolConfigsfrom the datasets adapter or equivalent)mapStyleId— current map style ID, used to resolve style-variant token valuessymbolRegistry— the core symbol registry instance
// In a plugin's MapLibre layer adapter
await mapProvider.registerSymbols(getSymbolConfigs(datasets), mapStyleId, symbolRegistry)Type: Object
Current map state, including:
{
zoom: 8,
center: [-1.5, 52.5],
bounds: [...],
// ... other map state
}Type: Object
Core services for interacting with the application.
Updates the map's aria-live region with a screen reader announcement. Use this to communicate important state changes to assistive technology users.
Note
This will override any pending core messages, so be sure to include necessary context. This function is experimental and subject to change.
context.services.announce('3 results found')Returns a location description for the given coordinates. Uses the reverseGeocodeProvider if configured in options.
const description = await context.services.reverseGeocode(zoom, center)
// e.g. "Manchester, Greater Manchester"Note
Further work is planned to provide richer results with optional detail levels and zoom-dependent descriptions.
Closes the map if in fullscreen mode and returns to the previous page. Use this when your interaction needs to exit the map entirely.
context.services.closeApp()Registry of named symbol definitions. Use this to register custom symbols that can be referenced by name in dataset or feature configs.
See Symbol Registry for full documentation.
Registry of named fill pattern definitions. Built-in patterns ('dot', 'cross-hatch', 'diamond', etc.) are pre-registered. Use this to register custom named patterns that can be shared across plugins.
context.services.patternRegistry.register('my-hatch', '<path d="M0 0L16 16" stroke="{{foregroundColor}}"/>')Patterns authored in a 16×16 coordinate space. Use {{foregroundColor}} and {{backgroundColor}} tokens for colour injection.
Pub/sub event bus for communication within the application.
const { eventBus } = context.services
// Subscribe to an event
eventBus.on('map:panel-opened', ({ panelId }) => {
console.log('Panel opened:', panelId)
})
// Unsubscribe from an event
eventBus.off('map:panel-opened', handler)
// Emit an event
eventBus.emit('my-plugin:custom-event', { data: 'value' })See Events for available event name constants.