SMK Usage Guide

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

This project is maintained by bcgov

SMK / Configuration / Tools

Directions Tool

Add a button to the toolbar, that shows a panel that allows the user to pick locations on the map, and calculate the fastest (or shortest) route between them.

This tool interacts with the "identify" tool and "location" tool. When this tool is enabled, the popups for identify and location will contain a button to start a route from that location.

The application developer will need to acquire and provide a value for the "apiKey" in the "routePlannerService" property in order to use this tool.

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

{ "tools": [ {
    "type":      "directions",
    "title":     "Route Planner",
    "showTitle": false,
    "enabled":   false,
    "icon":      "directions_car",
    "order":     4,
    "position":  [ "shortcut-emnu", "list-menu", "toolbar" ],
    "command":   {
        "optimal":     true,
        "roundTrip":   true,
        "criteria":    true,
        "vehicleType": true,
        "truckRoute":  true,
        "truckHeight": true,
        "truckWidth":  true,
        "truckLength": true,
        "truckWeight": true,
    },
    "truck":       false,
    "optimal":     false,
    "roundTrip":   false,
    "criteria":    "shortest",
    "truckRoute":  null,
    "truckHeight": null,
    "truckWidth":  null,
    "truckLength": null,
    "truckWeight": null,
    "geocoderService": {
        "url": "https://geocoder.api.gov.bc.ca/",
        "timeout": 10000,
        "parameter": {}
    }
    "routePlannerService": {
        "url": "https://router.api.gov.bc.ca/",
        "apiKey": null
    }
} ] }

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.

Optimal Sub-Property

"command": { "optimal": Boolean }

If true, shows the Optimal control in the directions tool options.

RoundTrip Sub-Property

"command": { "roundTrip": Boolean }

If true, shows the Round Trip control in the directions tool options.

Criteria Sub-Property

"command": { "criteria": Boolean }

If true, shows the Criteria control in the directions tool options.

VehicleType Sub-Property

"command": { "vehicleType": Boolean }

If true, shows the Vehicle Type control in the directions tool options.

TruckRoute Sub-Property

"command": { "truckRoute": Boolean }

If true, shows the Truck Route control in the directions tool options.

TruckHeight Sub-Property

"command": { "truckHeight": Boolean }

If true, shows the Truck Height control in the directions tool options.

TruckWidth Sub-Property

"command": { "truckWidth": Boolean }

If true, shows the Truck Width control in the directions tool options.

TruckLength Sub-Property

"command": { "truckLength": Boolean }

If true, shows the Truck Length control in the directions tool options.

TruckWeight Sub-Property

"command": { "truckWeight": Boolean }

If true, shows the Truck Weight control in the directions tool options.

Truck Property

"truck": Boolean

If true, the route planner generates a route specifically for a truck, otherwise the route is for any vehicle.

Optimal Property

"optimal": Boolean

If true, the route planner will optimize the order of waypoints to find the shortest route, otherwise the waypoints are taken in the order presented.

RoundTrip Property

"roundTrip": Boolean

If true, the route planner will generate a route that visits all waypoints, and then returns to the first one. Otherwise, the route will start at the first waypoint, and end at the last waypoint.

Criteria Property

"criteria": String

The value can be "fastest" or "shortest", and the route planner will try to find the best route according to that constraint. See Route Planner Docs.

TruckRoute Property

"truckRoute": Number

Truck route multiplier. See Route Planner Docs.

TruckHeight Property

"truckHeight": Number

Height of truck in meters.

TruckWidth Property

"truckWidth": Number

Width of truck in meters.

TruckLength Property

"truckLength": Number

Length of truck in meters.

TruckWeight Property

"truckWeight": Number

Weight of truck in kilograms.

GeocoderService Property

"geocoderService": Object

The configuration object used to connect to the BC Geocoder Service. The default configuration object is:

{
    "url": "https://geocoder.api.gov.bc.ca/",
    "timeout": 10000,
    "parameter": {}
}

Typically an application will need a specific form of geocoder request, and so will need to provide a "parameters" object.

RoutePlannerService Property

"routePlannerService": Object

The configuration object used to connect to the BC Route Planner. The default configuration object is:

{
    "url": "https://router.api.gov.bc.ca/",
    "apiKey": null
}

The application developer will need to acquire and provide a value for the "apiKey" in order to use this service. See the Route Planner documentation for details.