Skip to main content

MapCairnOptions

What a map is mounted with, besides its element. Every option is optional.

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

Signature​

import type { MapCairnOptions } from "@mapcairn/map";

interface MapCairnOptions

Properties​

about​

readonly about?: MountAbout;

The About block in Help. None when left out. In releases after 0.2.0, not in 0.2.0 or any earlier release.

basemap​

readonly basemap?: string;

The id of the basemap to start on when neither the shared link nor the saved choice names one on offer. The default of the basemaps, for the theme, when left out. A later change applies to the map that is showing, over the link and the saved choice, until the person picks another.

basemaps​

readonly basemaps?: readonly BasemapDefinition[];

The basemaps offered, as plain definitions. When left out, those the services offer, or else the SDK's built-in basemaps.

readonly creditsLink?: MountLink;

A link to the page's own About page, listed after the map credits. None when left out. In releases after 0.2.0, not in 0.2.0 or any earlier release.

engineNotice​

readonly engineNotice?: MountEngineNotice;

The notice for a map that cannot run. None when left out. In releases after 0.2.0, not in 0.2.0 or any earlier release.

label​

readonly label?: string;

The name of this map. Give each of several maps on a page its own.

language​

readonly language?: string;

The tag of the language to start on: one the page offers, or "en-GB" when it offers none. Left as the settings have it when left out.

languages​

readonly languages?: readonly MountLanguage[];

Languages to offer besides English. The language switcher is in Settings.

layers​

readonly layers?: readonly LayerDefinition[] | (() => Promise<readonly LayerDefinition[]>);

The layers a person can turn on, as plain definitions or a function that loads them. The layers are listed in the Map options sheet, so name "map-options" in tools; without it they are not shown. Every layer starts off. A list is checked when the map is mounted, even when "map-options" is not named, and throws if it is not valid or if a layer in it needs services.layerSource (a feed, a query or a heatmap layer, or a tile layer with an identify block) and none was given. A tile or vector layer without an identify block never needs one. A function that fails, a layer it returns that is not valid and one that needs services.layerSource when there is none are reported through the error event, and the rest are kept.

mainLandmark​

readonly mainLandmark?: boolean;

Whether the map is wrapped in the page's main landmark. False when left out, because a page has one main landmark and usually has its own. In releases after 0.2.0, not in 0.2.0 or any earlier release.

messageStore​

readonly messageStore?: MessageStore;

The message store the page made with createMessageStore from the same services, and keeps for its own pages: the map reads the language from it in place of making one of its own, so the page and the map are always in one language, and the Try again of a language that failed to load asks the page's store, which the page's lang follows. The map does not hand the store its services: the page does, as it does for its own pages. Left out, the map makes its own. In releases after 0.2.0, not in 0.2.0 or any earlier release.

notes​

readonly notes?: MountNotes;

Notes in the page's words. See MountNotes. Setting them draws the map again. In releases after 0.2.0, not in 0.2.0 or any earlier release.

privacyHref​

readonly privacyHref?: string;

Where the privacy policy is, shown as a link under Privacy in Settings: a path on the page's site (/privacy) or an http or https address. Any other address (javascript:, data:, //other.example) is a MountMapError naming this option. No link when left out or empty. In releases after 0.2.0, not in 0.2.0 or any earlier release.

regionId​

readonly regionId?: string;

The id of the map region, so a skip link the page drew before the map existed can point at it. Text without spaces. The region has no id when left out. The ids that link parts inside the map to each other are the map's own and are not affected. An id is unique in a page, so two maps, or a map and the page, must not share one, and an empty text is an error. In releases after 0.2.0, not in 0.2.0 or any earlier release.

services​

readonly services?: Partial<Services>;

The services, whole or in part, that the definition's defaults build on, as a plain object. What the defaults say these offer as a catalogue cannot also be given as basemaps, layers or languages. For map's own definition they must be the whole of Services, and of layer catalogues only emptyLayerCatalogue itself counts as none.

theme​

readonly theme?: ThemeChoice;

The theme choice to write to the settings. Left as the definition's defaults have it when left out.

tools​

readonly tools?: readonly MapTool[];

The tools to add. None when left out: zoom, the compass, the credits and the scale are always there.

tour​

readonly tour?: MountTour;

The first-visit tour. None when left out: the map then has no tour, and Help offers none. Setting it draws the map again. In releases after 0.2.0, not in 0.2.0 or any earlier release.

view​

readonly view?: ViewState;

The view to start on when neither the shared link services.url reads nor a saved lastView has one. A view of the whole world when left out.

See also​

Source: packages/map/src/element/types.ts:167