The plugin allows to avoid cluttering in marker labels and gives priority to labels of your choice (with higher weight).

addLabelgun(map, group = NULL, weight = NULL, entries = NULL)

Arguments

map

A map widget object created from leaflet

group

The group name of the layer/s for which label collisions are to be avoided. To see the effects of this plugin the labelOptions of the markers must be configured with either permanent = TRUE or noHide = TRUE.

weight

An optional weight for markers. If a vector is given, the length should match the number of all markers in the corresponding groups. If a numeric value is specified, it is used for each marker and thus no prioritization of the labels takes place. In all other cases a random integer is calculated.

entries

A numeric value, a higher value relates to faster insertion and slower search, and vice versa. The default is 10

Value

A leaflet map object

Note

It is important to invoke the function after the markers have been added to the map. Otherwise nothing will happen.