Skip to main content

Map Initialization

initMap

Function initMap(options) -> {Promise<Map>} Returns A Promise that delivers the Mapbox GL Map when initialized; this is the Mapbox web map object that will be used throughout the rest of the API. Description Initializes a Mapbox web map. Example Map centered on Kinetica HQ:

WMS Layer

addWmsLayer

Function addWmsLayer(map, options) -> {Promise<Object>} Returns A layer parameters object; useful for testing purposes. Description Adds a WMS raster-styled layer to the Mapbox map. Example Raster image of offices from an office table with lat & lon columns for coordinates:

updateWmsLayer

Function updateWmsLayer(map, options) -> {Object} Returns An object containing the map, WMS URL, source name, layer name, query parameters, and the redraw function; useful for testing purposes Description Updates a WMS layer’s parameters with the passed options. Useful for updating WMS output styling parameters based on UI interactions. Example Update raster image of offices, turning each point into a green circle:

updateWmsLayerType

Function updateWmsLayerType(map, layerId, layerType, debounceLimit) -> {Object} Returns An object containing the redraw function and the debounce limit; useful for testing purposes Description Changes an existing WMS layer’s rendering type and sets all of its parameters to the default values. Useful for changing a layer’s presentation without having to destroy the old layer and create a new one. Example Update layer of offices to a heatmap:

removeWmsLayer

Function removeWmsLayer(map, layerId) -> {Void} Returns Void Description Removes a WMS layer from the map, based on layer ID; this includes the layer source and event listeners Example Remove offices layer:

addCbLegend

Function addCbLegend(map, legendTitle, location, cbConfig) -> {Void} Returns Void Description Adds a WMS raster styled layer to the Mapbox map Example Add a legend to a class break on offices by the number of employees at each; offices of up to 20 employees will be green, between 21 and 40 will be yellow, and 41 or more employees will be shaded red:

setLayerOpacity

Function setLayerOpacity(map, layerId, opacity) -> {Void} Returns Void Description A helper function to easily set a layer’s opacity Example Set opacity of offices layer to 50%:

Cluster Layer

addClusterLayer

Function addClusterLayer(map, options) -> {Promise} Returns Returns a promise that resolves with the map, cluster object, update function, and options used to generate the cluster. Useful for testing purposes. Description Adds a geohash cluster visualization layer to the Mapbox map
A WKT column is not currently allowed when creating clusters—x/y columns must be used.
Example Clustering of employees from an office_employee table with lat & lon columns for coordinates, each cluster calculating the total of the salaries earned by all employees located at offices within the cluster:

Events

The following events can be acted upon using the Kinetica Kickbox.js Event API

on

Function on(name, cb) -> {Void} Returns Void Description Registers a callback with the given event name; an ID can be specified to allow a subsequent unregister call by ID instead of function signature, which requires storing function references globally Example Log to console immediately after a WMS layer is added, and assign a callback ID of myCallbackId for subsequent use in turning this event handler off using offById:

off

Function off(name, cb) -> {Void} Returns Void Description Unregisters a callback with the given event name and callback function Example Stop calling afterWmsLayerUpdateCb when afterWmsLayerUpdated events occur:
As noted in on, the callback function reference passed in here must be the same reference passed to the on function

offById

Function offById(name, cbId) -> {Void} Returns Void Description Unregisters a callback that has a kbFnId property equal to the specified cbId Example Stop calling the callback function with an ID of myCallbackId when afterWmsLayerUpdated events occur:
This ID must match the one assigned to the callback function before calling the on function

trigger

Function trigger(name) -> {Void} Returns Void Description Triggers a Kinetica Kickbox.js event for all listeners of the event with the specified name Example Fire the afterWmsLayerUpdated event, triggering all listeners for that event to invoke their respective callback functions:

Identify Modes

enableIdentifyByRadiusMode

Function enableIdentifyByRadiusMode(map, options) -> {Void} Returns Void Description Enables the identify-by-radius mode on a specified layer, after first disabling any currently active identify mode
The Mapbox GL and Mapbox GL Draw objects require a separate install from Kinetica Kickbox.js
Example Enable geospatial filtering of data via click-and-drag of a circle on the offices map layer, prefixing hex values in the color_code column with a #:

enableIdentifyByPointMode

Function enableIdentifyByPointMode(map) -> {Void} Returns Void Description Enables the identify-by-point mode on a specified layer, after first disabling any currently active identify mode
The Mapbox GL and Mapbox GL Draw objects require a separate install from Kinetica Kickbox.js
Example Enable geospatial filtering of data via click of a point on the offices map layer and applying a 200m fixed radius to determine the filtered area, prefixing hex values in the color_code column with a #:

disableIdentifyMode

Function disableIdentifyMode(map) -> {Void} Returns Void Description Disables the currently active identify-by-radius or identify-by-point mode and unregisters all callbacks driving the user interaction with this mode Example Disable any active identify mode: