如何将图标添加到包 Leaflet R 中的图层控件?我用以下代码制作了图标:
rojos <- makeAwesomeIcon(icon='ion-waterdrop', library='ion', markerColor = 'red', iconColor = 'white')
verdes <- makeAwesomeIcon(icon='ion-waterdrop', library='ion', markerColor = 'green', iconColor = 'white')
并使用以下代码制作了地图
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)
)
结果如下:
我想得到这种风格的东西,但是用我的图标: