Hepsini Bir Araya Getirmek

R ile leaflet kullanarak Etkileşimli Haritalar

Rich Majerus

Vice President of Strategy & Planning, Queens University of Charlotte

Gözden Geçirme

  • Leaflet ve htmlwidgets
  • Taban haritalar
  • Daire işaretçiler
  • Renk paletleri
  • Çokgenler
  • Katmanlar
  • Süslemeler

NC log gelir koroplet 2

NC log gelir koroplet 3

R ile leaflet kullanarak Etkileşimli Haritalar

Hepsini Bir Araya Getirmek

leaflet() %>% 
  addTiles(group = "OSM") %>% 
  addProviderTiles("CartoDB", group = "Carto") %>% 
  addProviderTiles("Esri", group = "Esri") %>%

addPolygons(data = shp, weight = 1, fillOpacity = .75, color = ~nc_pal(log(mean_income)), label = ~paste0("Mean Income: ", dollar(mean_income)), group = "Mean Income") %>%
R ile leaflet kullanarak Etkileşimli Haritalar

Hepsini Bir Araya Getirmek

  addCircleMarkers(data = nc_public, radius = 2, 
                   label = ~htmlEscape(name), 
                   color = ~pal(sector_label),group = "Public") %>% 
  addCircleMarkers(data = nc_private, radius = 2, 
                   label = ~htmlEscape(name),
                   color = ~pal(sector_label), group = "Private") %>% 
  addCircleMarkers(data = nc_profit, radius = 2, 
                   label = ~htmlEscape(name),
                   color = ~pal(sector_label),
                   group = "For-Profit") %>% 

addLayersControl(baseGroups = c("OSM", "Carto", "Esri"), overlayGroups = c("Public", "Private", "For-Profit", "Mean Income"))
R ile leaflet kullanarak Etkileşimli Haritalar

Hepsini Bir Araya Getirmek

NC log gelir koroplet 4

R ile leaflet kullanarak Etkileşimli Haritalar

Haritayı Kaydetme

# Store leaflet map in object
m <- leaflet() %>% 
     addTiles() %>%
     addMarkers(data = ipeds,
                clusterOptions = markerClusterOptions()) %>% 
     addPolygons(data = shp)
# save leaflet object as html file
library(htmlwidgets)

saveWidget(m, file="myMap.html")
R ile leaflet kullanarak Etkileşimli Haritalar

Hadi pratik yapalım!

R ile leaflet kullanarak Etkileşimli Haritalar

Preparing Video For Download...