Skip to content

<mosaica-layer-picker>

A list of checkboxes for choosing which annotation layers the map draws.

Put the layer picker beside a map when the bundle has annotation layers that viewers should be able to turn on and off. A layer that others depend on, such as a clustering and its labels, has one checkbox, so that the whole group is turned on together.

Filter layers draw nothing, so the picker names them in a note instead of giving them checkboxes. Viewers filter by a filter layer from its card in <mosaica-filter-panel>, or browse it in <mosaica-hierarchy> when its artifacts form a hierarchy.

import '@mosaicajs/components/layer-picker';

Attributes

Attribute Property Type Default Description
viewer-url viewerUrl string '' The base URL of the Mosaica viewer server, for the store the element builds: a full URL such as https://maps.example.org, or a path such as /mosaica. Unset, the page's own origin. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store.
token token string '' A viewer token for the store the element builds. Without token or authorise, only an open server (serve.open) answers. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store.
artifacts-per-tile artifactsPerTile number | null null The most artifacts one level of a layer shows per map tile, for the store the element builds. Unset, 50, or the server's selection.max_artifacts_per_tile if lower. A value above that maximum is refused. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store.

Properties

Set as JavaScript properties; they have no attribute.

Property Type Default Description
store Store | null null The store to use, ahead of one from context or one the element would build. The element never disposes it.
authorise TokenSupplier | null null A function that returns a viewer token, used instead of token and called again before the token expires. A different function builds a new store, so keep it stable across renders. Set it together with viewer-url: a store built from viewer-url alone first sends a request with no token, and is replaced when authorise arrives.
activeStore Store | null read-only The store this element is using, or null if it has none.
source StoreSource read-only Where activeStore came from.

Methods

Method Returns Description
dispose() void Dispose of the store this element built. Removing the element from the page does not, so call this when you are done with the element. A store you passed in is left to you.

Events

Each bubbles and is composed. Events gives each detail.

Event Fired when
mosaica-layerchange A checkbox changed which layers are drawn.

Parts

Styled from outside the element with ::part().

Part Description
title The heading.
state The state line, with data-state.
refusal The words "View refused", with data-code, in the refused state.
reason The server's reason for a refusal, under "View refused".
entry One layer that draws, with data-layer.
name A layer's title, or its name if it has no title.
note The note naming the filter layers, such as "Venues can be used as a filter only.", with data-layers listing their names.

CSS custom properties

The theme tokens apply to this element.