SMK Usage Guide

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

This project is maintained by bcgov

SMK / Configuration / Tools

Query Tool

Add a button to the toolbar, that shows a panel containing an input form. When user fills out the form and clicks the ‘Search’ button, a query is performed on a layer, and the results are shown at bottom of the panel, as well as on the map.

The queries are defined on layer objects, this tool needs to know which query to use. The instance property must contain the id of the query object (which is associated with a layer).

The title of the panel and tool button come from the query, so don’t set the "title" property on this tool.

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

{ "tools": [ {
    "type":      "query",
    "instance":  null
    "showPanel": true,
    "showHeader": true,
    "enabled":   false,
    "icon":      "widgets",
    "order":     5,
    "position":  "toolbar",
    "command":   {
        "navigator":     true,
        "zoom":          true,
        "select":        true,
        "attributeMode": false,
        "within":        true,
    },
    "attributeMode":  "default",
    "within":         false,
} ] }

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".

Instance Property

"instance": String

This tool must be paired with a query defined on a layer. The instance for this tool is an id constructed from the layer id, and the query id: "<<layer.id>>--<<query.id>>".

ShowTitle Property

"showTitle": Boolean

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

ShowPanel Property

"showPanel": Boolean

If true, then the tool panel will be shown. If false, then the tool panel will not be shown when the tool is active.

ShowHeader Property

"showHeader": Boolean

If true, then the tool panel will have a header, showing title and close button.

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.

"command": { "navigator": Boolean }

If true, shows the navigation controls for selecting among many matched features.

Zoom Sub-Property

"command": { "zoom": Boolean }

If true, shows a button for zooming to current feature.

Select Sub-Property

"command": { "select": Boolean }

If true, shows a button for adding the current feature to the selection.

AttributeMode Sub-Property

"command": { "attributeMode": Boolean }

If true, shows a drop-down list for selecting how the feature attributes should be presented.

within Sub-Property

"command": { "within": Boolean }

If true, shows a toggle for selecting search mode.

AttributeMode Property

"attributeMode": String

Determines how the attributes are presented for a feature. These are the possible modes:

Note

One of the modes possible when attributeMode == "default" is one that uses the feature template defined for the layer. This mode is the most preferred one if possible, but it is not possible to force attributeMode to always use it.

Within Property

"within": Boolean

If false, then the query will search the entire dataset no matter what the extent currently in view.

If true, then the query will be restricted to the current extent.