Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201919

Leaflet plotting not only Countries but also regions of each country

$
0
0

So I am learning leaflet library for maps and I would like to ask how to plot not only countries but also regions for each country all well,

Regions can be clearly seen but is there a way hot to plot their each polygons and the same time?

This is how I am working on it:

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


Viewing all articles
Browse latest Browse all 201919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>