addcluster_legend: Add marker layer and legend

View source: R/addpoly_legend.R

addcluster_legendR Documentation

Add marker layer and legend

Description

Adds marker layer and legend to leaflet map, with points in cluster layer shaded by palette function

Usage

addcluster_legend(
  leafletobj,
  var,
  pal_funct,
  grp,
  labvar,
  popuptext,
  clusterpoints = T,
  title = grp,
  radius = 0.1,
  weight = 20,
  df = leaflet::getMapData(leafletobj),
  ...
)

Arguments

leafletobj

Leaflet object

var

String name of variable colored in cluster layer

pal_funct

Palette function to color cluster layer

grp

Group of cluster layer

labvar

Label to show when hover over a point; can feed either a data-masked variable name, or a set of labels created by leafletwrappers::label_standard function

popuptext

Labels to show in pop-up over point, created by leafletwrappers::label_output function

clusterpoints

Whether to cluster points; default true

title

Title of legend; default grp

radius

Radius of points; default 0.1. To size by a variable, can feed a formula with the sqrt() of a data-masked variable; e.g., ~ sqrt(unitsize)

weight

Weight of points; default 20

df

Spatial dataframe behind layer; default leaflet::getMapData(leafletobj)

...

Additional .label or .popup arguments for leafletwrappers::addcluster_standard, or opacity argument for leafletwrapper::addlegend_standard

Value

Leaflet object with cluster layer and legend


dpowerstp/leafletwrappers documentation built on Sept. 4, 2022, 10:19 a.m.