Map Management

Map Management

DataSetMapLayer

MapBoxGL custom layer showing DataSet elements on the map.

new DataSetMapLayer(options: Object)

Extends Base

Parameters
options (Object) configuration object for this class
Name Description
options.dataSet String the DataSet instance associated with this layer
options.layerId String unique identifier of this layer; if this parameter is not defined then the identifier of the underlying DataSet is used instead.
options.syncGeo Boolean this flag defines if the currently applied bounding box (visible zone of the map) should be used to filter search results
options.onSelect Function optional method called when a new feature is selected. This method can be used to center the map on the feature and return back when the selection is canceled (when the intent is finished). See MapBoxGL#flyTo method. This method recieves a parameter object with the following fields:
  • intent: the DataSetGroup selection intent allowing (EV_GROUP_SELECTED)
  • map: the map instance
  • layer: this layer
  • feature: the selected feature
  • isCluster: boolean flag showing if this feature is a cluster
  • featureCenter: geographical center of this feature
options.feature Object configuration for features
options.feature.style Object styles DataSet features
options.feature.style.basic Object styles for non-selected features
options.feature.style.selected Object styles for selected features
options.feature.style.hover Object styles for hovered features
options.feature.popup Object popups definitions
options.feature.popup.selected Function method rendering the popup for selected features
options.feature.popup.hover Function method rendering the hover popups
options.cluster Object configuration for clusters
options.cluster.style Object styles for clusters
options.cluster.style.basic Object non-selected cluster styles
options.cluster.style.selected Object styles for selected clusters
options.cluster.style.hover Object styles for hovered clusters
options.cluster.popup Object popups definitions
options.cluster.popup.selected Function method rendering the popup for selected clusters
options.cluster.popup.hover Function method rendering the hovered clusters
Instance Members
id
type
map
dataSet
mapContext
glyphUrl
syncGeo
bboxUpdateTimeout
addTo(map, options)
then(resolve, reject)
catch(onError)
onAdd(map)
onRemove(map, gl)
render(gl, matrix)

MapEvents

Contains keys of events used by DataSetMapLayer and MapContext classes.

MapEvents
Events
EV_MAP_UPDATE
EV_LAYER_HOVER
EV_LAYER_CLICK
EV_DESTROY
EV_UPDATE_GLYPH_URL
EV_ADD_LAYER
EV_UPDATE_STYLE

DataSetMapStyles

Utility class managing MapBoxGL styles for DataSet. It uses a vector tile URL to generate sources and the corresponding MapBoxGL layers with styles descriptions. Selected and hovered GeoJSON items are used to dynamically generate GeoJSON sources and provide the corresponding visualization layers.

DataSetMapStyles

Extends Base

Parameters
options (Object) configuration object for this class
Name Description
options.map String mandatory MapBoxGL instance
options.tilesUrl String URL of vector tiles used for this layer
options.before String optional ID of an existing layer to insert DataSet-related layers before; if this parameter is not defined (or null) then DataSet-related layers are added on the top of the map
options.feature Object styles for features
options.feature.default Object default feature styles
options.feature.selected Object styles for selected features
options.feature.hovered Object styles for hovered features
options.cluster Object styles for clusters
options.cluster.default Object default cluster styles
options.cluster.selected Object styles for selected clusters
options.cluster.hovered Object styles for hovered clusters
options.getIconsFont Function this function takes the name of the IconSet and return the corresponding font name; This font name is used to access to MapBoxGL glyphs. See MarkerBuilder .
options.getIconChar Function this function takes two parameters: the name of the IconSet and the logical icon name. It returns the the character corresponding to the given icon. This character is used to reference the icon glyph. See MarkerBuilder .
layerId (String) mandatory layer identifier; used to generate identifiers for MapBoxGL sources and layers
Example
```
const styles = new DataSetMapStyles({
  // Unique layer identifier; used to generate MapBox GL layers and styles
  layerId : 'foobar',
  // Styles for features
  feature : {
    default : { type : 'Marker', ...},
    selected : { type : 'Marker', ...},
    hovered : { type : 'Marker', ...},
  },
  // Styles for clusters
  cluster : {
    default : { type : 'Marker', ...},
    selected : { type : 'Marker', ...},
    hovered : { type : 'Marker', ...},
  },
});
// Highlight a hovered feature
styles.setHoveredFeature('e9b36004-1227-4743-813e-36a8d31e0b47');
// Highlight a hovered cluster
styles.setHoveredCluster(123);
```
Instance Members
map
layerId
beforeLayer
tilesUrl
setHoveredFeature(feature)
setSelectedFeature(feature)
setSelectedCluster(cluster)
setHoveredCluster(cluster)
mapboxLayerIds
_removeAll()
_initAll()

MapContext

A context associated with a MapBoxGL instance. It allows to synchronize / operations initialized by different layers. For example it allows to show just one popup corresponding for a specific key (ex: popups for hovered features and popups for selected features).

new MapContext(options: Object)

Extends Base

Parameters
options (Object) constructor options
Name Description
options.map Object mandatory MapBoxGL instance
Static Members
getContext(map)
Instance Members
setGlyphUrl(url)
hoverTimeout
map
mapInfo
addMapListener(event, listener)
showPopup(options)
setBbox(bbox)
addLayerGroups(groups)
addLayerGroup(groupId, layerIds)
removeLayerGroup(groupId)
setLayerGroup(groupId, layerIds)
getGroupLayers(groupId)
createHTMLElement(name)
_newPopup(options)
_notifyLayer(eventKey, field, e)
_getEventFeatures(e)

Builder

Common super class for other types of builders.

Builder
Instance Members
_assignFunction(f, errorMsg)
_assign(condition, errorMsg)

LabeledMarkerBuilder

Cluster-specific marker builder. It uses the same attributes as the MarkerBuilder class and it adds additional filters to select only cluster points from vector tiles.

LabeledMarkerBuilder

Extends Builder

MarkerBuilder

Transform high-level marker styles to a set of "low-level" MapBoxGL styles.

MarkerBuilder

Extends Builder

Parameters
options (Object) builder parameters
Name Description
options.getIconsFont Function this function takes the name of the IconSet and return the corresponding font name; This font name is used to access to MapBoxGL glyphs.
options.getIconChar Function this function takes two parameters: the name of the IconSet and the logical icon name. It returns the the character corresponding to the given icon. This character is used to reference the icon glyph.

parseFilter

This method parses the given string and returns the corresponding array with resulting values.

parseFilter(str: String, listener: Object): Array
Parameters
str (String) the string to parse
listener (Object = newListener()) a listener object containing the following methods:
  • open: this method is called when a new array is opened
  • close: is called to close arrays
  • onValue: is called to notify about parsed values
Returns
Array: with resulting filter