Class: Marker

cercaliagl.layer/Marker


Layer for markers. This layer has the possibility to cluster markers with different values such radius and max zoom. This class manages events and its callbacks methods. All methods such as addMarker, removeMarker must be used from cercaliagl.Map methods. Don't use methods not published in this document page to avoid possibles strange map behaviours.

new Marker(options)

Name Type Description
options
Name Type Description
id string

Layer id

map module:cercaliagl/Map~Map

Mapbox Map

type string

Type

onClusterClick function

Callback function when mouse click cluster feature.

onClusterMouseOver function

Callback function when mouse over cluster feature.

onClusterMouseOut function

Callback function when mouse out cluster feature.

clusteringEnabled Boolean

Enable/Disable clustering. Default true.

Extends

Methods

disableClustering()

Disable clustering markers.

disableHeatmap()

enableClustering(maxZoom, clusterRadius)

Enable clustering. Clustering agroup markers in circle features showing total features clustered over this circular feature. Callback events for cluster feature events is possible using module:cercaliagl/Map~Map#enableClustering method

Name Type Description
maxZoom number

Max zoom. Default 16

clusterRadius number

Radius in pixels for every cluster. Default 40.

enableHeatmap(styleZones, stylePoints)

Converts layer into heatmap. There are two layers: Zone layer for heat, and points layer. Points layers is useful to show markers in the nearest zooms. Read MapboxGL documentation to styling both layers: https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#heatmap.

Name Type Description
styleZones StyleHeat

Zones styles.

stylePoints StyleHeat

Points styles.

getId(){string} inherited

Obtain layer id.

Returns:
Layer id.

getOverlappedMarkers(currentExtentView, opt_tolerance){Array.<Array.<ol.Feature>>}

Get Overlapped markers

Name Type Description
currentExtentView boolean | undefined

If true returns only visible markers at the moment, if not null or false it returns all markers

tolerance number

Tolerance in meters.

Returns:
Array of group (array) of features.

separateOverlapMarkers(separation)

Overlap markers if some markers coincides in the same exact coordinate. This function must be called after add or remove markers.

Name Type Description
separation number (defaults to 3)

Separation from anchor. Default 3.

toggleLayers(visible)

Name Type Description
visible boolean

Visible