how to add icons to the layer control in package Leaflet R?. I made icons with the following code:
rojos <- makeAwesomeIcon(icon='ion-waterdrop', library='ion', markerColor = 'red', iconColor = 'white')
verdes <- makeAwesomeIcon(icon='ion-waterdrop', library='ion', markerColor = 'green', iconColor = 'white')
and with the following code I made the map
agua <-leaflet(options = leafletOptions(zoomControl = TRUE,
minZoom = 10, maxZoom = 17,
dragging = TRUE))%>%
addTiles()%>%
setView(-101.145,19.793, 10) %>%
# MAPAS BASE
addProviderTiles(providers$OpenStreetMap.BlackAndWhite, group = "Calles") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "Imagen satelital") %>%
###########################################################################################################
addGeoJSONv2(
jsonlite::toJSON(rojo),
markerType="marker",
markerIcons = rojos,
popupProperty='popup',
labelProperty='NOMBRE DEL CUERPO DE AGUA',
group = "Agua contaminada") %>%
addGeoJSONv2(
jsonlite::toJSON(verde),
markerType="marker",
markerIcons = verdes,
popupProperty='popup',
labelProperty='NOMBRE DEL CUERPO DE AGUA',
group = "Agua no contaminada") %>%
#POLIGONOS
addPolygons(data = cuitzeo, col="green",fillColor="Transparent", group = "Cuenca de Cuitzeo",
weight = 3, opacity = 1)%>%
addPolygons(data = pol_mor, col="#000000",fillColor="Transparent",
group = "Límite Municipal Morelia",
weight = 2, opacity = 1, fillOpacity = .8) %>%
# CONTROL DE CAPAS
addLayersControl(
baseGroups = c("Calles","Imagen satelital"),
overlayGroups = c("Agua contaminada","Agua no contaminada","Cuenca de Cuitzeo","Límite Municipal Morelia"),
options = layersControlOptions(collapsed = F)
)
the result of this is the following:
I would like to get something of this style, but with my icons: