addMapkeyMarkers {leaflet.extras2}R Documentation

Add Mapkey Markers

Description

Add Mapkey Markers

Usage

addMapkeyMarkers(
  map,
  lng = NULL,
  lat = NULL,
  layerId = NULL,
  group = NULL,
  icon = NULL,
  popup = NULL,
  popupOptions = NULL,
  label = NULL,
  labelOptions = NULL,
  options = leaflet::markerOptions(),
  clusterOptions = NULL,
  clusterId = NULL,
  data = leaflet::getMapData(map)
)

Arguments

map

the map to add mapkey Markers to.

lng

a numeric vector of longitudes, or a one-sided formula of the form ~x where x is a variable in data; by default (if not explicitly provided), it will be automatically inferred from data by looking for a column named lng, long, or longitude (case-insensitively)

lat

a vector of latitudes or a formula (similar to the lng argument; the names lat and latitude are used when guessing the latitude column from data)

layerId

the layer id

group

the name of the group the newly created layers should belong to (for clearGroup and addLayersControl purposes). Human-friendly group names are permitted–they need not be short, identifier-style names. Any number of layers and even different types of layers (e.g. markers and polygons) can share the same group name.

icon

the icon(s) for markers;

popup

a character vector of the HTML content for the popups (you are recommended to escape the text using htmlEscape() for security reasons)

popupOptions

A Vector of popupOptions to provide popups

label

a character vector of the HTML content for the labels

labelOptions

A Vector of labelOptions to provide label options for each label. Default NULL

options

a list of extra options for markers. See markerOptions

clusterOptions

if not NULL, markers will be clustered using Leaflet.markercluster; you can use markerClusterOptions() to specify marker cluster options

clusterId

the id for the marker cluster layer

data

the data object from which the argument values are derived; by default, it is the data object provided to leaflet() initially, but can be overridden

Value

the new map object

References

https://github.com/mapshakers/leaflet-mapkey-icon

See Also

Other Mapkey Functions: [.leaflet_mapkey_icon_set(), makeMapkeyIcon(), mapkeyIconList(), mapkeyIcons()

Examples

library(leaflet)

leaflet()  %>%
  addTiles() %>%
  addMapkeyMarkers(data = breweries91,
                icon = makeMapkeyIcon(icon = "mapkey",
                                      iconSize = 30,
                                      boxShadow = FALSE,
                                      background = "transparent"),
                group = "mapkey",
                label = ~state, popup = ~village)

[Package leaflet.extras2 version 1.2.2 Index]