Open
Description
I've noticed the the color used to with addGlifyPolygons
doesn't work for all tile providers.
See RE:
# loading the libraries
library(sf)
library(leaflet)
library(leaflet.glify)
library(colourvalues)
# preparing the shapefile
nc <- st_read(system.file("gpkg/nc.gpkg", package="sf"), quiet = TRUE) %>%
st_transform(st_crs(4326)) %>%
st_cast('POLYGON')
# setting the colors
cols = colour_values_rgb(nc$AREA, palette = "inferno", include_alpha = FALSE) / 255
# making the first map like in your example:
leaflet() %>%
addProviderTiles(provider = providers$CartoDB.DarkMatter) %>%
leaflet.glify:::addGlifyPolygons(nc, color = cols) %>%
fitBounds(lng1 = unname(st_bbox(nc)$xmin), lng2 = unname(st_bbox(nc)$xmax), lat1 = unname(st_bbox(nc)$ymin), lat2 = unname(st_bbox(nc)$ymax))
# making the second map with a different tile provider:
leaflet() %>%
addProviderTiles(provider = providers$OpenStreetMap.Mapnik) %>%
leaflet.glify:::addGlifyPolygons(nc, color = cols) %>%
fitBounds(lng1 = unname(st_bbox(nc)$xmin), lng2 = unname(st_bbox(nc)$xmax), lat1 = unname(st_bbox(nc)$ymin), lat2 = unname(st_bbox(nc)$ymax))
Do you know what the problem is?
Metadata
Metadata
Assignees
Labels
No labels