Skip to content

MapRendererOptions

Defined in: packages/core/src/renderer/map-renderer.ts:342

Options for MapRenderer

PropertyTypeDescriptionDefined in
camera?"document" | "host"Who owns the camera across updates (live documents, KTD13). document (the default): a changed center, zoom, bearing or pitch eases the map there and an added or re-targeted fitTo frames its source once. host: the engine never moves the camera; the host re-applies the document camera itself on update:applied when it wants it.packages/core/src/renderer/map-renderer.ts:457
capabilities?CapabilityPolicyTrust and runtime capabilities for this map. Remarks Gates render-time behavior an author could otherwise abuse — most directly whether an !html popup value renders as markup or as escaped text. Omitted means untrusted: a host embedding a document it did not author gets the safe default without opting into it.packages/core/src/renderer/map-renderer.ts:380
chrome?ChromeMount[]Host-supplied chrome elements (U9 — <ml-map> slot children), mounted into the shared corner system (KTD10) on load, after the built-in legend and params panel so those keep the corner edge. The renderer BORROWS these elements: destroy() removes the corner containers they sit in, so a host that wants them back (re-render, error card) must move them out first — <ml-map> parks them on itself.packages/core/src/renderer/map-renderer.ts:428
controls?objectControls declared in the YAML controls: block — added automatically on map loadpackages/core/src/renderer/map-renderer.ts:365
controls.attribution?boolean | { compact?: boolean; customAttribution?: string | string[]; enabled?: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:124
controls.fullscreen?boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:123
controls.geolocate?boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:121
controls.globe?boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:127
controls.navigation?boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:118
controls.scale?boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:122
controls.terrain?boolean | { enabled: boolean; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; }-packages/core/src/schemas/map.schema.ts:130
deferChrome?booleanBuilt off the page for a fallback rebuild (KTD8): the host’s chrome and legendElement — borrowed from the map still showing — are left where they are at style load and mounted by MapRenderer.mountHostChrome, which the host calls when this map takes the old one’s place. A swap that never commits moves nothing.packages/core/src/renderer/map-renderer.ts:492
description?stringWhat the map shows (the document’s description:): a visually hidden element the canvas points at with aria-describedby.packages/core/src/renderer/map-renderer.ts:363
images?Record<string, string | { pixelRatio?: number; sdf?: boolean; url: string; }>Named images (images:) registered via map.addImage before layers are added, so icon-image/*-pattern references resolve on first render.packages/core/src/renderer/map-renderer.ts:396
initialCamera?objectThe camera to build the map at instead of the document’s (KTD8): a fallback rebuild carries the previous map’s view across. The document’s own camera keys and fitTo stay in the applied document, unapplied, so the next update diffs against the document, not the carried view.packages/core/src/renderer/map-renderer.ts:484
initialCamera.bearingnumber-packages/core/src/renderer/map-renderer.ts:484
initialCamera.center[number, number]-packages/core/src/renderer/map-renderer.ts:484
initialCamera.pitchnumber-packages/core/src/renderer/map-renderer.ts:484
initialCamera.zoomnumber-packages/core/src/renderer/map-renderer.ts:484
initialState?Record<string, unknown>state: values to apply after the document’s defaults on load, as a reader’s writes (live documents, KTD8): a fallback rebuild carries the previous map’s current values across. Keys the document’s state: block does not declare are ignored, as setState refuses them.packages/core/src/renderer/map-renderer.ts:471
initialVisibility?Record<string, boolean>Layer visibility a reader set through the panel, by layer id (KTD8): applied once the layers are on the map and seeding the panel’s toggles, so a hidden layer stays hidden and unchecked across a rebuild.packages/core/src/renderer/map-renderer.ts:477
legend?false | { collapsed: boolean; items?: object[]; position: "top-left" | "top-right" | "bottom-left" | "bottom-right"; title?: string; }Legend declared in the YAML legend: block — built automatically on map load. Absent with a classify: layer: an automatic legend; false: none.packages/core/src/renderer/map-renderer.ts:370
legendElement?HTMLElementHost-supplied legend element that REPLACES the built-in legend (the legend slot). Mounted at legend.position (default top-left); the auto legend is not built. Borrowed, like chrome.packages/core/src/renderer/map-renderer.ts:434
light?objectThe style-spec light (U10′), applied with map.setLight on load — the live style is built from mapStyle + addLayer, so the document’s light cannot ride in on the style object.packages/core/src/renderer/map-renderer.ts:402
light.anchor?any[] | "map" | "viewport"-packages/core/src/schemas/map.schema.ts:772
light.color?string | any[]-packages/core/src/schemas/map.schema.ts:784
light.intensity?number | any[]-packages/core/src/schemas/map.schema.ts:787
light.position?any[] | [number, number, number]-packages/core/src/schemas/map.schema.ts:778
markers?object[]Standalone markers: — DOM pins added on load, removed on destroy.packages/core/src/renderer/map-renderer.ts:389
onError?(error, fatal?, context?) => voidfatal distinguishes load-aborting failures (source registration, layer add — the document will never reach load) from runtime maplibre error events (a 404’d tile, a missing sprite) that the map survives. Optional second argument, so existing single-arg callbacks are unaffected. The optional third, MapErrorContext, says which part of the document failed — the basemap style (fatal), one layer, or one source — or is absent for errors that are not the document’s (a basemap tile).packages/core/src/renderer/map-renderer.ts:353
onLoad?() => void-packages/core/src/renderer/map-renderer.ts:343
onReattachEffects?() => voidDetach and re-attach @maplibre-yaml/effects (live documents, KTD6b): called by an update that adds or removes an effect: block, or rebuilds or moves an effect-bearing layer, so the ::fx- layers follow. <ml-map> supplies it; a host rendering effects itself does the same.packages/core/src/renderer/map-renderer.ts:464
parameters?Record<string, unknown>parameters: presentation metadata — rendered as the params panel (U8), each control writing its state key via setGlobalStateProperty. Loosely typed to match the schema’s passthrough record; the panel builder reads it as ParameterMeta.packages/core/src/renderer/map-renderer.ts:409
popups?object[]Standalone popups: (U14) — opened at their coordinates on load.packages/core/src/renderer/map-renderer.ts:391
prefetchedExtents?Record<string, [number, number, number, number]>Extents the host already read, [west, south, east, north] by source id (ml-aot.120): <ml-map> reads a fitTo COG’s header before it builds the map, so the map is built framed on the file instead of jumping there once the COG reader reports it.packages/core/src/renderer/map-renderer.ts:449
projection?objectProjection (projection:, U15) — map.setProjection, maplibre-gl >= 5.packages/core/src/renderer/map-renderer.ts:419
projection.type"globe" | "mercator"-packages/core/src/schemas/map.schema.ts:748
sky?objectSky / fog / atmosphere (sky:, U15) — map.setSky, maplibre-gl >= 4.5.packages/core/src/renderer/map-renderer.ts:417
sky.atmosphere-blend?number | any[]-packages/core/src/schemas/map.schema.ts:718
sky.fog-color?string | any[]-packages/core/src/schemas/map.schema.ts:706
sky.fog-ground-blend?number | any[]-packages/core/src/schemas/map.schema.ts:715
sky.horizon-color?string | any[]-packages/core/src/schemas/map.schema.ts:703
sky.horizon-fog-blend?number | any[]-packages/core/src/schemas/map.schema.ts:712
sky.sky-color?string | any[]-packages/core/src/schemas/map.schema.ts:700
sky.sky-horizon-blend?number | any[]-packages/core/src/schemas/map.schema.ts:709
sourceData?LayerManagerDataOptionsData loading the host already started for named sources (ml-aot.75): <ml-map> fetches a fitTo source’s url: before it builds the map, and hands the load over here so the source’s first load awaits it instead of fetching again (one request), through the same fetcher and cache. Optional; without it every source loads itself, as before.packages/core/src/renderer/map-renderer.ts:442
state?Record<string, unknown>The document’s state: block ({ key: { default } } per the style spec). Applied on load via setGlobalStateProperty so global-state expressions read the declared defaults — the live style is built from mapStyle + addLayer, so the block cannot ride in on the style object.packages/core/src/renderer/map-renderer.ts:387
terrain?objectMap-level 3D terrain (terrain:, U15). Applied via map.setTerrain once its raster-dem source exists — the live style is built from mapStyle + addLayer, so it cannot ride in on the style object.packages/core/src/renderer/map-renderer.ts:415
terrain.exaggeration?number-packages/core/src/schemas/map.schema.ts:656
terrain.sourcestring-packages/core/src/schemas/map.schema.ts:652
title?stringThe map’s name (the document’s title:): the canvas’s accessible name, in place of MapLibre’s generic locale["Map.Title"] (“Map”).packages/core/src/renderer/map-renderer.ts:358