Skip to main content

BasemapDefinition

A basemap, as data. This is the single source for the picker, the attribution content and the thumbnails. Nothing else may name a tile URL or an attribution string.

This is an interface exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import type { BasemapDefinition } from "@mapcairn/core";

interface BasemapDefinition

Properties​

appearance​

readonly appearance: "light" | "dark";

Whether the basemap itself is light or dark, used for chrome contrast.

attribution​

readonly attribution: readonly BasemapAttributionEntry[];

Provider credits, in display order.

id​

readonly id: string;

Unique among the basemaps a host offers. It is the value kept in settings and the address as basemapId.

maxZoom​

readonly maxZoom: number;

The deepest normalised zoom the basemap allows. For a raster source it is also the deepest tile level the provider serves.

minZoom​

readonly minZoom: number;

Normalised zoom limits (256 px tile convention). For a raster source, maxZoom is also the deepest tile level the provider serves.

name​

readonly name: DefinitionText;

What the picker calls the basemap: a MessageKey the active catalogue translates (the SDK's own basemaps use one, such as basemap.bright.name), or a plain string shown as written, as a host's own basemap may use.

nonCommercial​

readonly nonCommercial?: boolean;

True when the provider's licence allows only non-commercial use. The SDK's own basemaps have none, so it stays free for commercial use; a host that accepts such terms may add one to its own catalogue. A host must leave such a basemap out of any tool an agent can call, as the reference host's basemapChoices does, because an agent must not accept a provider's licence on a person's behalf.

source​

readonly source: BasemapSource;

Where the basemap's tiles or style come from.

swatch​

readonly swatch?: string;

A six-digit hex colour (#rrggbb) for the picker's plain swatch, which a basemap with no preview image shows. Without it the swatch is the interface's map background colour, the default basemap's land colour. Set it for a basemap that is not light, so its tile does not look like the default one. It colours the tile in the picker, and a hybrid basemap's ground before its imagery draws, and is the host's choice. It may be the style's own land colour where the provider's terms allow it, and is otherwise a colour of the host's own, never one sampled from the provider's map or screenshots.

thumbnail​

readonly thumbnail?: string;

Root-relative path of a preview image that the host serves. The SDK ships no image files, so its own definitions name none and a host that has previews adds the path to the definitions it offers. A basemap with none is shown in the picker as a plain colour swatch, and so is one whose image fails to load.

See also​

Source: packages/core/src/ports/basemap.ts:67