MapRenderer
Defined in: packages/core/src/renderer/map-renderer.ts:602
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MapRenderer(
container,config,layers?,options?,sources?):MapRenderer
Defined in: packages/core/src/renderer/map-renderer.ts:715
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
container | string | HTMLElement | undefined |
config | objectOutputType | undefined |
layers | (objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<{ id: ZodString; layout: ZodOptional<ZodObject<{ }, "passthrough", ZodTypeAny, objectOutputType<{ }, ZodTypeAny, "passthrough">, objectInputType<{ }, ZodTypeAny, "passthrough">>>; metadata: ZodOptional<ZodRecord<ZodString, ZodAny>>; paint: ZodOptional<ZodObject<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">>>; type: ZodLiteral<"background">; }, ZodTypeAny, "passthrough">)[] | [] |
options | MapRendererOptions | {} |
sources? | Record<string, objectOutputType<{ attribution: ZodOptional<ZodString>; buffer: ZodOptional<ZodNumber>; cache: ZodOptional<ZodObject<{ enabled: ZodDefault<ZodBoolean>; ttl: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { enabled: boolean; ttl?: number; }, { enabled?: boolean; ttl?: number; }>>; cluster: ZodOptional<ZodBoolean>; clusterMaxZoom: ZodOptional<ZodNumber>; clusterMinPoints: ZodOptional<ZodNumber>; clusterProperties: ZodOptional<ZodRecord<ZodString, ZodAny>>; clusterRadius: ZodOptional<ZodNumber>; columns: ZodOptional<ZodUnion<[ZodLiteral<"all">, ZodArray<ZodString, "many">]>>; data: ZodOptional<ZodAny>; fetchStrategy: ZodDefault<ZodEnum<["runtime", "build", "hybrid"]>>; format: ZodOptional<ZodEnum<["pmtiles", "flatgeobuf", "geoparquet", "cog"]>>; generateId: ZodOptional<ZodBoolean>; lineMetrics: ZodOptional<ZodBoolean>; load: ZodOptional<ZodUnion<[ZodEnum<["all", "viewport"]>, ZodObject<{ maxFeatures: ZodOptional<…>; minzoom: ZodOptional<…>; mode: ZodOptional<…>; overviews: ZodOptional<…>; }, "strip", ZodTypeAny, { maxFeatures?: … | …; minzoom?: … | …; mode?: … | … | …; overviews?: … | … | …; }, { maxFeatures?: … | …; minzoom?: … | …; mode?: … | … | …; overviews?: … | … | …; }>]>>; loading: ZodOptional<ZodObject<{ enabled: ZodDefault<ZodBoolean>; message: ZodOptional<ZodString>; showErrorOverlay: ZodDefault<ZodBoolean>; }, "strip", ZodTypeAny, { enabled: boolean; message?: string; showErrorOverlay: boolean; }, { enabled?: boolean; message?: string; showErrorOverlay?: boolean; }>>; prefetchedData: ZodOptional<ZodAny>; promoteId: ZodOptional<ZodUnion<[ZodString, ZodRecord<ZodString, ZodString>]>>; refresh: ZodOptional<ZodEffects<ZodObject<{ refreshInterval: ZodOptional<ZodNumber>; timestampField: ZodOptional<ZodString>; updateKey: ZodOptional<ZodString>; updateStrategy: ZodDefault<ZodEnum<…>>; windowDuration: ZodOptional<ZodNumber>; windowSize: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy?: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }>, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy?: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }>>; refreshInterval: ZodOptional<ZodNumber>; stream: ZodOptional<ZodObject<{ eventTypes: ZodOptional<ZodArray<ZodString, "many">>; protocols: ZodOptional<ZodUnion<[…, …]>>; reconnect: ZodDefault<ZodBoolean>; reconnectDelay: ZodDefault<ZodNumber>; reconnectMaxAttempts: ZodDefault<ZodNumber>; reconnectMaxDelay: ZodDefault<ZodNumber>; type: ZodEnum<["websocket", "sse"]>; url: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { eventTypes?: string[]; protocols?: string | string[]; reconnect: boolean; reconnectDelay: number; reconnectMaxAttempts: number; reconnectMaxDelay: number; type: "websocket" | "sse"; url?: string; }, { eventTypes?: string[]; protocols?: string | string[]; reconnect?: boolean; reconnectDelay?: number; reconnectMaxAttempts?: number; reconnectMaxDelay?: number; type: "websocket" | "sse"; url?: string; }>>; tolerance: ZodOptional<ZodNumber>; type: ZodLiteral<"geojson">; updateKey: ZodOptional<ZodString>; updateStrategy: ZodOptional<ZodEnum<["replace", "merge", "append-window"]>>; url: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ attribution: ZodOptional<ZodString>; bounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; encoding: ZodOptional<ZodEnum<["mvt", "mlt"]>>; format: ZodOptional<ZodEnum<["pmtiles", "flatgeobuf", "geoparquet", "cog"]>>; maxzoom: ZodOptional<ZodNumber>; minzoom: ZodOptional<ZodNumber>; promoteId: ZodOptional<ZodUnion<[ZodString, ZodRecord<ZodString, ZodString>]>>; scheme: ZodOptional<ZodEnum<["xyz", "tms"]>>; tiles: ZodOptional<ZodArray<ZodEffects<ZodString, string, string>, "many">>; type: ZodLiteral<"vector">; url: ZodOptional<ZodString>; volatile: ZodOptional<ZodBoolean>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ attribution: ZodOptional<ZodString>; bounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; colorRamp: ZodOptional<ZodObject<{ classes: ZodOptional<ZodNumber>; colors: ZodOptional<ZodArray<ZodString, "many">>; max: ZodNumber; min: ZodNumber; palette: ZodOptional<ZodString>; reverse: ZodOptional<ZodBoolean>; }, "strip", ZodTypeAny, { classes?: number; colors?: string[]; max: number; min: number; palette?: string; reverse?: boolean; }, { classes?: number; colors?: string[]; max: number; min: number; palette?: string; reverse?: boolean; }>>; format: ZodOptional<ZodEnum<["pmtiles", "flatgeobuf", "geoparquet", "cog"]>>; maxzoom: ZodOptional<ZodNumber>; minzoom: ZodOptional<ZodNumber>; scheme: ZodOptional<ZodEnum<["xyz", "tms"]>>; tiles: ZodOptional<ZodArray<ZodEffects<ZodString, string, string>, "many">>; tileSize: ZodDefault<ZodNumber>; type: ZodLiteral<"raster">; url: ZodOptional<ZodString>; volatile: ZodOptional<ZodBoolean>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ attribution: ZodOptional<ZodString>; bounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; encoding: ZodDefault<ZodEnum<["terrarium", "mapbox", "custom"]>>; format: ZodOptional<ZodEnum<["pmtiles", "flatgeobuf", "geoparquet", "cog"]>>; maxzoom: ZodOptional<ZodNumber>; minzoom: ZodOptional<ZodNumber>; tiles: ZodOptional<ZodArray<ZodEffects<ZodString, string, string>, "many">>; tileSize: ZodDefault<ZodNumber>; type: ZodLiteral<"raster-dem">; url: ZodOptional<ZodString>; volatile: ZodOptional<ZodBoolean>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ coordinates: ZodTuple<[ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>], null>; type: ZodLiteral<"image">; url: ZodString; }, ZodTypeAny, "passthrough"> | objectOutputType<{ coordinates: ZodTuple<[ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>], null>; type: ZodLiteral<"video">; urls: ZodArray<ZodString, "many">; }, ZodTypeAny, "passthrough"> | { attribution?: string; bands?: number[]; bounds?: [number, number, number, number]; cache?: { enabled: boolean; ttl?: number; }; encoding: "geotiff" | "rg-uv" | "scalar-r" | "nullschool-json"; grid?: { dx: number; dy: number; la1: number; lo1: number; nx: number; ny: number; }; loading?: { enabled: boolean; message?: string; showErrorOverlay: boolean; }; nodata?: number | { above?: number; below?: number; channel: "a" | "b" | "r" | "g"; equals?: number; }; range?: [number, number]; type: "grid"; units?: string; url: string; }> | undefined |
Returns
Section titled “Returns”MapRenderer
Methods
Section titled “Methods”addControls()
Section titled “addControls()”addControls(
config):void
Defined in: packages/core/src/renderer/map-renderer.ts:1860
Add controls to the map
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config | { attribution?: boolean | { compact?: boolean; customAttribution?: string | string[]; enabled?: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; fullscreen?: boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; geolocate?: boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; globe?: boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; navigation?: boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; scale?: boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; terrain?: boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }; } |
config.attribution? | boolean | { compact?: boolean; customAttribution?: string | string[]; enabled?: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
config.fullscreen? | boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
config.geolocate? | boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
config.globe? | boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
config.navigation? | boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
config.scale? | boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
config.terrain? | boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; } |
Returns
Section titled “Returns”void
Remarks
Section titled “Remarks”Called automatically on map load when a controls: config was passed via
MapRendererOptions. Calling it manually marks controls as added so
the automatic invocation is skipped (no double-add).
addLayer()
Section titled “addLayer()”addLayer(
layer):Promise<void>
Defined in: packages/core/src/renderer/map-renderer.ts:1709
Add a layer to the map
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layer | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<{ id: ZodString; layout: ZodOptional<ZodObject<{ }, "passthrough", ZodTypeAny, objectOutputType<{ }, ZodTypeAny, "passthrough">, objectInputType<{ }, ZodTypeAny, "passthrough">>>; metadata: ZodOptional<ZodRecord<ZodString, ZodAny>>; paint: ZodOptional<ZodObject<{ background-color: ZodOptional<ZodUnion<[ZodEffects<ZodString, string, string>, ZodType<…[], ZodTypeDef, …[]>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…[], ZodTypeDef, …[]>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…[], ZodTypeDef, …[]>]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, ZodTypeAny, "passthrough">>>; type: ZodLiteral<"background">; }, ZodTypeAny, "passthrough"> |
Returns
Section titled “Returns”Promise<void>
buildLegend()
Section titled “buildLegend()”buildLegend(
container,layers,config?):void
Defined in: packages/core/src/renderer/map-renderer.ts:1873
Build legend in container
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
container | string | HTMLElement |
layers | (objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<{ id: ZodString; layout: ZodOptional<ZodObject<{ }, "passthrough", ZodTypeAny, objectOutputType<{ }, ZodTypeAny, "passthrough">, objectInputType<{ }, ZodTypeAny, "passthrough">>>; metadata: ZodOptional<ZodRecord<ZodString, ZodAny>>; paint: ZodOptional<ZodObject<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">>>; type: ZodLiteral<"background">; }, ZodTypeAny, "passthrough">)[] |
config? | { collapsed: boolean; items?: object[]; position: "top-left" | "top-right" | "bottom-left" | "bottom-right"; title?: string; } |
config.collapsed? | boolean |
config.items? | object[] |
config.position? | "top-left" | "top-right" | "bottom-left" | "bottom-right" |
config.title? | string |
Returns
Section titled “Returns”void
Remarks
Section titled “Remarks”Called automatically on map load when a legend: config was passed via
MapRendererOptions. Calling it manually marks the legend as built
so the automatic invocation is skipped (no double-build).
destroy()
Section titled “destroy()”destroy():
void
Defined in: packages/core/src/renderer/map-renderer.ts:2693
Destroy the map and clean up resources
Returns
Section titled “Returns”void
failedSources()
Section titled “failedSources()”failedSources():
ReadonlySet<string>
Defined in: packages/core/src/renderer/map-renderer.ts:2381
The sources whose last load failed, for hints.failedSources (KTD11): reload() retries them.
Returns
Section titled “Returns”ReadonlySet<string>
getDocument()
Section titled “getDocument()”getDocument():
AppliedDocument
Defined in: packages/core/src/renderer/map-renderer.ts:2352
The normalized document this map shows (KTD15): the shape the
constructor receives and update() takes, never the parsed MapBlock
(<ml-map>.getDocument() returns that). After update:applied it is
the next document, failures included: the document is the source of
truth (KTD7).
Returns
Section titled “Returns”getGrid()
Section titled “getGrid()”getGrid(
sourceId):GridField|undefined
Defined in: packages/core/src/renderer/map-renderer.ts:2391
A grid source’s field (grid source, R14): the decoded, sampleable field
once it is in, undefined before that and for any other id. Never
mutated: a live update that changes the source hands out a new one
(source:loaded says when).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sourceId | string |
Returns
Section titled “Returns”GridField | undefined
getLegendBuilder()
Section titled “getLegendBuilder()”getLegendBuilder():
LegendBuilder
Defined in: packages/core/src/renderer/map-renderer.ts:2624
Get the legend builder instance
Returns
Section titled “Returns”getMap()
Section titled “getMap()”getMap():
maplibregl.Map
Defined in: packages/core/src/renderer/map-renderer.ts:1682
Get the underlying MapLibre map instance
Returns
Section titled “Returns”getState()
Section titled “getState()”getState():
Record<string,unknown>
Defined in: packages/core/src/renderer/map-renderer.ts:2061
The document’s current state: values (live documents, KTD6): its
defaults, the panel’s seeds and every write since, by key.
Returns
Section titled “Returns”Record<string, unknown>
gridReady()
Section titled “gridReady()”gridReady(
sourceId):Promise<GridField>
Defined in: packages/core/src/renderer/map-renderer.ts:2413
A grid source’s field once it is in (R14). Rejects with an Error naming
the id when the applied document has no grid source of that id; with
the source’s FormatError when its load fails (a later reload()
gives new callers a fresh promise); and when the source is removed or
the renderer destroyed while the load is in flight. Does not wait for
mapReady()’s layers — only for the style load that registers sources.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sourceId | string |
Returns
Section titled “Returns”Promise<GridField>
hasGrid()
Section titled “hasGrid()”hasGrid(
sourceId):boolean
Defined in: packages/core/src/renderer/map-renderer.ts:2401
Whether the applied document has a type: grid source of this id,
decoded or not: tells “not decoded yet” from “no such source” without
awaiting gridReady. False before the style load registers the
document’s sources, after the source is removed, and once destroyed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sourceId | string |
Returns
Section titled “Returns”boolean
isMapLoaded()
Section titled “isMapLoaded()”isMapLoaded():
boolean
Defined in: packages/core/src/renderer/map-renderer.ts:1702
Check if map is loaded
Returns
Section titled “Returns”boolean
mountHostChrome()
Section titled “mountHostChrome()”mountHostChrome():
void
Defined in: packages/core/src/renderer/map-renderer.ts:2582
Put the host’s chrome into the corner system (KTD10): the legend slot
at its corner’s edge, in the built-in legend’s place, then the chrome
elements after the built-in pieces. Once: at style load, or, for a map
built off the page (deferChrome), when the host commits the swap
(KTD8) — right before it is shown, so the elements leave the old map
only then and never for a map that fails to load.
Returns
Section titled “Returns”void
noteImageReference()
Section titled “noteImageReference()”noteImageReference(
property,value):void
Defined in: packages/core/src/renderer/map-renderer.ts:1695
Record an image property value the document sets at runtime (a story’s
setLayoutProperty action, for example), so a missing image it names is
reported as the document’s, not dismissed as a basemap sprite gap.
Values of non-image properties are ignored.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
property | string | The layout/paint property (icon-image, fill-pattern, …). |
value | unknown | Its value: a name, a {token} string, or an expression. |
Returns
Section titled “Returns”void
off<
K>(event,callback):void
Defined in: packages/core/src/renderer/map-renderer.ts:2641
Unregister an event listener
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof MapRendererEvents |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | K |
callback | (data) => void |
Returns
Section titled “Returns”void
on<
K>(event,callback):void
Defined in: packages/core/src/renderer/map-renderer.ts:2631
Register an event listener
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof MapRendererEvents |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | K |
callback | (data) => void |
Returns
Section titled “Returns”void
pause()
Section titled “pause()”pause():
void
Defined in: packages/core/src/renderer/map-renderer.ts:2425
Stop this map’s pipelines (polling, by-view loaders): a fallback rebuild is replacing it (KTD8).
Returns
Section titled “Returns”void
rebuildSeed()
Section titled “rebuildSeed()”rebuildSeed():
object
Defined in: packages/core/src/renderer/map-renderer.ts:2441
What a fallback rebuild seeds the next map with (KTD8): the state:
values a reader wrote (setState, the panel; not the document’s defaults
or the panel’s seeds, which the next document provides again) and the
panel’s visibility overrides, as the next renderer’s initialState and
initialVisibility.
Returns
Section titled “Returns”object
| Name | Type | Defined in |
|---|---|---|
initialState | Record<string, unknown> | packages/core/src/renderer/map-renderer.ts:2441 |
initialVisibility | Record<string, boolean> | packages/core/src/renderer/map-renderer.ts:2441 |
removeLayer()
Section titled “removeLayer()”removeLayer(
layerId):void
Defined in: packages/core/src/renderer/map-renderer.ts:1829
Remove a layer from the map
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layerId | string |
Returns
Section titled “Returns”void
resume()
Section titled “resume()”resume():
void
Defined in: packages/core/src/renderer/map-renderer.ts:2430
The counterpart of pause: the rebuild failed and this map stays.
Returns
Section titled “Returns”void
setCameraOwner()
Section titled “setCameraOwner()”setCameraOwner(
owner):void
Defined in: packages/core/src/renderer/map-renderer.ts:2376
Who owns the camera from the next update on (KTD13): <ml-map camera> changed on a running map.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
owner | "document" | "host" |
Returns
Section titled “Returns”void
setLayerVisibility()
Section titled “setLayerVisibility()”setLayerVisibility(
layerId,visible):void
Defined in: packages/core/src/renderer/map-renderer.ts:1838
Set layer visibility
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layerId | string |
visible | boolean |
Returns
Section titled “Returns”void
setState()
Section titled “setState()”setState(
values):void
Defined in: packages/core/src/renderer/map-renderer.ts:2077
Write state: values (live documents, R12): each goes through
setGlobalStateProperty, the params panel follows, and one
state:change fires. A key the document’s state: block does not
declare refuses the whole call — nothing is written — and a write made
before the map loads is applied once it does, after the defaults.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
values | Record<string, unknown> |
Returns
Section titled “Returns”void
Throws
Section titled “Throws”When a key is undeclared, or the running maplibre-gl has no
setGlobalStateProperty (below 5.6).
update()
Section titled “update()”update(
next,hints?):Promise<UpdateResult>
Defined in: packages/core/src/renderer/map-renderer.ts:2470
Apply a changed document to the running map in place (live documents,
0.10): layers, sources, runtime features and the camera follow the
difference between the applied document and next; nothing else is
touched, and a host’s own layers are never moved or removed (R10).
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
next | AppliedDocument | undefined | The normalized document, as the constructor takes it. |
hints | DiffHints | NO_HINTS | What the documents don’t say (KTD11): sources whose last load failed and whether base re-resolved URLs. Default: none, so an unchanged document is a no-op. |
Returns
Section titled “Returns”Promise<UpdateResult>
Remarks
Section titled “Remarks”Resolves when the outcome is final (KTD5): applied after the last
operation and re-sync (with update:applied fired), fallback when
next needs a rebuild (mapStyle, a constructor-only option) — decided
before anything is awaited, and nothing is mutated: the host rebuilds —,
rejected with kind: 'chunk' when the engine’s file couldn’t be
downloaded (update:rejected fired, map and document unchanged), or
superseded when a later update() replaced this one in the queue.
One update applies at a time; an update arriving mid-apply waits, and
only the last waiting one runs, against the document applied by then.
An update made before the map’s own load waits for it.
updateLayerData()
Section titled “updateLayerData()”updateLayerData(
layerId,data):void
Defined in: packages/core/src/renderer/map-renderer.ts:1845
Update layer data
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layerId | string |
data | GeoJSON |
Returns
Section titled “Returns”void
fromModel()
Section titled “fromModel()”
staticfromModel(container,model,options?):MapRenderer
Defined in: packages/core/src/renderer/map-renderer.ts:701
Construct a renderer from the v2 internal model.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
container | string | HTMLElement |
model | MapModel |
options | MapRendererOptions |
Returns
Section titled “Returns”MapRenderer
Remarks
Section titled “Remarks”The model is the shape the emitter is written against (R30), and this is how the renderer consumes the same one. v0.5.0 keeps the v1 constructor as the compatibility surface — it is public API with external callers, and breaking it inside a minor is not on the table — so this factory reassembles the v1 arguments rather than the managers being rewritten onto new shapes.
<ml-map> does not call this — it derives the same arguments inline, so
the component test double (which mocks MapRenderer as a bare function
with no statics) keeps working. This factory is for callers that already
hold a model. It differs from the inline path in one respect worth knowing:
caller options win over the model’s controls/legend, so passing
{ controls: undefined } erases them.