Skip to content

resolveMapBlock

resolveMapBlock(mapBlock, globalConfig?): object

Defined in: packages/core/src/utils/config-resolver.ts:163

Resolves a complete MapBlock by applying global defaults to its config.

ParameterTypeDescription
mapBlock{[key: string]: any; }The map block with potentially incomplete config
globalConfig?{ dataFetching?: { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }; defaultCenter?: [number, number]; defaultMapStyle?: string; defaultZoom?: number; description?: string; theme: "light" | "dark"; title?: string; }Global configuration with defaults
globalConfig.dataFetching?{ defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }-
globalConfig.dataFetching.defaultStrategy?"runtime" | "build" | "hybrid"-
globalConfig.dataFetching.retryAttempts?number-
globalConfig.dataFetching.timeout?number-
globalConfig.defaultCenter?[number, number]-
globalConfig.defaultMapStyle?string-
globalConfig.defaultZoom?number-
globalConfig.description?string-
globalConfig.theme?"light" | "dark"-
globalConfig.title?string-

object

Resolved map block with complete configuration

If required fields are missing after resolution

This function resolves the config property of a MapBlock while preserving all other block properties (layers, controls, legend, etc.).

const mapBlock = {
type: 'map',
id: 'my-map',
config: { center: [0, 0], zoom: 5 },
layers: [...]
};
const resolved = resolveMapBlock(mapBlock, {
defaultMapStyle: 'https://example.com/style.json'
});
// resolved.config.mapStyle === 'https://example.com/style.json'