SMK Usage Guide

A versatile and lightweight toolkit for building a simple web map.

This project is maintained by bcgov

SMK / Configuration / Tools

Layers Tool

Add a button to the toolbar, that shows a panel that lists all the "layers" configured for the map. It allows the user to hide or show any layer, and to see the layer legend. Use the display property to organize the layers into folders and groups.

This is default configuration for the Layers tool (click on a property name for more information):

{ "tools": [ {
    "type":      "layers",
    "title":     "Layers",
    "showTitle": false,
    "enabled":   false,
    "icon":      "layers",
    "order":     3,
    "position":  [ "shortcut-emnu", "list-menu", "toolbar" ],
    "command":   {
        "allVisibility":   true,
        "filter":          true,
        "legend":          true
    },
    "glyph":   {
        "visible":         "visibility",
        "hidden":          "visibility_off"
    },
    "display":  [ ... ]
} ] }

Type Property

"type": String (Required)

The name of the type of this tool. Identifies the tool in the configuration, this is required.

Must be one of these values: "about", "basemaps", "bespoke", "coordinate", "directions", "identify", "layers", "legend", "list-menu", "location", "markup", "measure", "minimap", "pan", "query", "scale", "search", "select", "shortcut-menu", "toolbar", "version", or "zoom".

Title Property

"title": String

The title of this tool. Tools that display a panel will use this as the title of the panel. The toolbar button for this tool will use this as the tooltip. Tools have a default title, and setting this property will override the default title with one of the author’s choosing.

ShowTitle Property

"showTitle": Boolean

If true, then the title of the tool is shown beside the button in the toolbar. Defaults to false.

Enabled Property

"enabled": Boolean

If true then the tool will be available when the map starts. If false, then the tool will not be available.

Icon Property

"icon": String

If the tool adds a button to a toolbar, this property gives the name of the icon to display on the button. The icon set used is the Material Design Icons.

Order Property

"order": Integer

If the tool adds a button to a toolbar, this property controls the order in which the tools are added to the toolbar. The default value is 1, but some tools have other values as their default. The tools are added left-to-right in ascending order.

Position Property

"position": String

Some tools show a button that activates the tool, and that button must be positioned in one of the tool button containers. The tool button containers are: toolbar, list-menu, and shortcut-menu. This property’s value is the name of the container, or null to prevent button from appearing. The tool button container must itself be enabled.

Command Property

"command": Object

Determines which controls are visible on the panels for this tool.

AllVisibility Sub-Property

"command": { "allVisibility": Boolean }

If true, shows the visibility control that toggles the state of all layers.

Filter Sub-Property

"command": { "filter": Boolean }

If true, shows the text entry field for filtering the layer list.

Legend Sub-Property

"command": { "legend": Boolean }

If true, shows a toggle that determines if a layer’s legend is displayed alongside the layer in the list.

Glyph Property

"glyph": Object

The icons used for elements in the layer list.

Visible Sub-Property

"glyph": { "visible": String }

The name of the icon representing a layer that the user wants to be visible.

Hidden Sub-Property

"glyph": { "hidden": String }

The name of the icon representing a layer that the user wants to be hidden.

Display Property

"display": Array

An array of Layer Display objects, that determines how the layers defined in the "layers" section of the configuration are to be organized in the layers panel. Each item in the array is an object that is one of these types: