Loading the package and looking at prepared data

We start by loading tidyverse package to manipulate with data and then load the package itself.

data(obce)
data(okresy)
id_okresy_Brno <- okresy %>% 
  filter(str_detect(nazev, "Brno")) %>% 
  pull(lau1_kod)

obce_obce <- obce %>% 
  filter(lau1_kod %in% id_okresy_Brno) %>% 
  datatable(options = list(scrollX = TRUE))

# saveWidget(obce_obce, file = "tabulka.html", selfcontained = FALSE)
id_obec <- obce %>% 
  filter(nazev == "Brno") %>% 
  pull(kod)
volebni_okrsky <- load_RUIAN_settlement(id_obec, layer = "volebni okrsky")
#>  Downloading data.
#>  Data unpacked.

volebni_okrsky <- volebni_okrsky %>% 
  select(cislo) %>% 
  st_transform(4326) 

volebni_okrsky <- ms_simplify(volebni_okrsky, keep = 0.1)

names(st_geometry(volebni_okrsky)) <- NULL
labels <- sprintf("<strong>%s</strong>", volebni_okrsky$cislo) %>% 
  lapply(htmltools::HTML)

l <- leaflet(data = volebni_okrsky, width = "100%") %>%
  addTiles() %>%
  addPolygons(fillColor = brewer.pal(8, "Set2"), fillOpacity = 0.4,
              stroke = TRUE, weight = 0.5, color = "black",
              highlight = highlightOptions(weight = 3,
                                           bringToFront = TRUE),
              label = labels)

# saveWidget(l, file = "mapa.html", selfcontained = FALSE)