Reputation: 23
Using the quakes data as an example and the code below, I wish to modify the icon size. I need to keep the rest of the code as unchanged as possible, I just want to make the icons smaller. Can anyone please help?
library(leaflet)
data(quakes)
quakes<-head(quakes,10)
quakes$stations<-as.factor(quakes$stations)
map<-leaflet()
map<-addTiles(map,group = "OSM (default)")
map<-addMarkers(map,quakes$lon, quakes$lat, group = quakes$stations,
clusterOptions = markerClusterOptions(maxClusterRadius = 5,transparent=TRUE,singleMarkerMode=TRUE,zoomToBoundsOnClick=FALSE,
iconCreateFunction=JS(paste0("function(cluster) {
var c = ' marker-cluster-small';
var html = '<div style=\"background-color:rgba(","#FF00DB",")\"><span>' + cluster.getChildCount() + '</div><span>'
return new L.DivIcon({html: html, className: 'marker-cluster' + c,iconSize: new L.Point(40, 40) });
}"))
)
)
map
Upvotes: 2
Views: 250