传单不仅标绘国家,而且标绘每个国家的地区

时间:2019-12-04 18:29:06

标签: r leaflet maps

所以我正在学习leaflet地图库,我想问一下如何 不仅可以绘制国家,还可以绘制每个国家的区域,

可以清楚地看到区域,但是有一种方法可以同时绘制每个多边形吗?

这就是我的工作方式:

library(mapview)
library(leaflet)
library(leaflet.extras)


m <- leaflet() %>% addProviderTiles("CartoDB.Positron") %>% 

  #  addProviderTiles("Stamen.TonerLines") %>% 

  addGraticule(group = "Graticule") %>%

  addLayersControl(overlayGroups = c("Graticule"),options = layersControlOptions(collapsed = FALSE)) %>% 

  addPolygons(data = world, col = 'black', fillOpacity = 0.0001, smoothFactor = 0.0001, weight = 1) %>% 

  addLegend(position = 'bottomleft', colors = c("green", "#FC4E07", "dodgerblue"), labels = c("Yes", "No", "Capital city"), opacity = 0.8,title = 'Map Legend') %>% 

  setView(lng = 18.9, lat = 52, zoom = 04.495) 

m

0 个答案:

没有答案