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

Layer Display Objects

The "layers" tool "display" property is an array of Display objects. There are 3 types of objects:

Display Layer Object

This object represents a layer from the "layers" section of the configuration.

{
    "type":      "layer",
    "id":              "layer1",
    "title":           "Layer 1",
    "isVisible":       true,
    "alwaysShowLegend":false,
}

Display Layer Id Property

"id": String

The id of a layer from the "layers" section of the configuration.

Display Layer Title Property

"title": String

The title to show for the layer. If this property is missing, the title is taken from the layer object refered to by "id".

Display Layer IsVisible Property

"isVisible": Boolean

Determines initial visibility of the layer. If this property is missing, then the initial visibility is taken from the "isVisible" is taken from the layer object refered to by "id".

Display Layer AlwaysShowLegend Property

"alwaysShowLegend": Boolean

If true, then the legend for the layer is always shown in the layers panel, regardless of the legend toggle. The default value is false.

Display Folder Object

This object is container for a collection of Display objects. The folder can be expanded and collapsed in the layers tool, so the internal structure of the folder is accessible. The visibility of the folder determines the visibility of all the child objects.

{
    "type":       "folder",
    "id":         "folder1",
    "title":      "Folder 1",
    "isVisible":  true,
    "isExpanded": false,
    "items":      [ ... ],
}

Display Folder Id Property

"id": String

The id of the folder, which must be unique. It can be omitted, and an id will be generated for the folder.

Display Folder Title Property

"title": String

The title to show for the folder.

Display Folder IsVisible Property

"isVisible": Boolean

Determines initial visibility of the folder, and consequently the visibility of all Display object contained within. The default value is true.

Display Folder IsExpanded Property

"isExpanded": Boolean

Determines initial expanded state of the folder. The default value is false, ie not expanded.

Display Folder Items Property

"items": Array

An array containing Layer Display objects, that are contained in this folder.

Display Group Object

This object is container for a collection of Display objects. The group cannot be expanded in the layers tool, and so the internal structure of the group is hidden from the user. The visibility of the group determines the visibility of all the child objects.

{
    "type":       "group",
    "id":         "group1",
    "title":      "Group 1",
    "isVisible":  true,
    "items":      [ ... ],
}

Display Group Id Property

"id": String

The id of the group, which must be unique. It can be omitted, and an id will be generated for the group.

Display Group Title Property

"title": String

The title to show for the group.

Display Group IsVisible Property

"isVisible": Boolean

Determines initial visibility of the group, and consequently the visibility of all Display object contained within. The default value is true.

Display Group Items Property

"items": Array

An array containing Layer Display objects. Because the internal structure is invisible, the only Display objects that make sense as child objects are { "type": "layer" }.