Skip to content

MapErrorContext

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

What part of the document a reported error belongs to — the third argument of MapRendererOptions.onError.

  • style: the basemap style never loaded (a 404/403/CORS failure, a URL that is not a style, an invalid inline style). Always fatal: no layer can draw without it.
  • layer: one document layer was rejected or could not be added (a bad paint value, a source: naming a source that does not exist). The rest of the map keeps working.
  • source: one document source failed at runtime (tiles or a TileJSON that would not load).
  • classify: a classified layer’s computed breaks can’t be computed (its source is read by view); the layer draws in its no-data colour.
  • classify-field: a hint — a classified layer’s field has no usable value in the loaded data, so every feature draws as no data.
  • layer-hint: a hint — a layer was added, but not as written (a before: naming no layer on the map: it went on top).
  • source-hint: a hint — a source draws, but its file is served in a way that makes it slow (a GeoTIFF that isn’t cloud-optimized), or its live merge updates carry features with no updateKey.

Errors with no context (a basemap tile, a glyph) are not the document’s.

PropertyTypeDescriptionDefined in
basemap?booleanFor source: the source is the basemap’s own (its PMTiles file failed), not one the document declared.packages/core/src/renderer/map-renderer.ts:318
center?[number, number]For center: the center as written.packages/core/src/renderer/map-renderer.ts:320
kind"center" | "source" | "layer" | "style" | "classify" | "basemap" | "fit" | "classify-field" | "source-hint" | "layer-hint"fit: config.fitTo.source names no source; the map keeps its authored camera. center: config.center looks written [latitude, longitude] — far from the document’s data, while the swapped pair lands on it. classify: a layer’s computed classes (method:) can’t be computed, because its source holds only the features in view; the layer draws in its no-data colour. The error message is the whole notice. classify-field: an author hint, not a failure — the loaded data has no usable value for a classified layer’s field: / normalize: (a misspelt or wrong-case name, or text under numeric classes). basemap: the basemap loaded, but something about it is wrong (a Protomaps basemap pmtiles: file that is some other kind of PMTiles). The error message is the whole notice. source-hint: an author hint, not a failure — a source draws, but its file could be served better (a GeoTIFF that isn’t cloud-optimized), or its live merge updates carry features with no updateKey (kept, not matched).packages/core/src/renderer/map-renderer.ts:303
layerId?stringThe document layer, for layer and classify errors.packages/core/src/renderer/map-renderer.ts:322
reason?"host-layer-collision"For layer errors from an update (KTD1): the document layer’s id is held by a layer the host added, so the document’s layer and its changes were skipped — an author hint, not a draw failure.packages/core/src/renderer/map-renderer.ts:336
sourceId?stringThe document source, for source errors; the name fitTo.source gave, for fit.packages/core/src/renderer/map-renderer.ts:324
suggestion?stringFor fit: the closest source name, when one is close.packages/core/src/renderer/map-renderer.ts:326
swapped?[number, number]For center: the swapped pair, [longitude, latitude].packages/core/src/renderer/map-renderer.ts:328
url?stringThe style URL, for style errors when the style was given as a URL.packages/core/src/renderer/map-renderer.ts:330