# 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

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

## Properties

### appearance

```ts
readonly appearance: "light" | "dark";
```

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

### attribution

```ts
readonly attribution: readonly BasemapAttributionEntry[];
```

Provider credits, in display order.

### id

```ts
readonly id: string;
```

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

### maxZoom

```ts
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

```ts
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

```ts
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

```ts
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

```ts
readonly source: BasemapSource;
```

Where the basemap's tiles or style come from.

### swatch

```ts
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

```ts
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

- [`BasemapAttributionEntry`](https://docs.mapcairn.com/api/core/BasemapAttributionEntry.md)
- [`DefinitionText`](https://docs.mapcairn.com/api/core/DefinitionText.md)
- [`BasemapSource`](https://docs.mapcairn.com/api/core/BasemapSource.md)

Source: [packages/core/src/ports/basemap.ts:67](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/ports/basemap.ts#L67)
