# NOT RUN {
if (interactive()) {
library(leaflet)
library(leafgl)
library(sf)
storms = st_as_sf(atlStorms2005)
cols = heat.colors(nrow(storms))
leaflet() %>%
addProviderTiles(provider = providers$CartoDB.Positron) %>%
addGlPolylines(data = storms, color = cols, popup = TRUE, opacity = 1)
}
if (interactive()) {
library(leaflet)
library(leafgl)
library(sf)
n = 1e5
df1 = data.frame(id = 1:n,
x = rnorm(n, 10, 1),
y = rnorm(n, 49, 0.8))
pts = st_as_sf(df1, coords = c("x", "y"), crs = 4326)
cols = topo.colors(nrow(pts))
leaflet() %>%
addProviderTiles(provider = providers$CartoDB.DarkMatter) %>%
addGlPoints(data = pts, fillColor = cols, popup = TRUE)
}
if (interactive()) {
library(leaflet)
library(leafgl)
library(sf)
gadm = st_as_sf(gadmCHE)
gadm = st_cast(gadm, "POLYGON")
cols = grey.colors(nrow(gadm))
leaflet() %>%
addProviderTiles(provider = providers$CartoDB.DarkMatter) %>%
addGlPolygons(data = gadm, color = cols, popup = TRUE)
}
# }
Run the code above in your browser using DataLab