Skip to content

Instantly share code, notes, and snippets.

@DATAUNIRIO
Created June 8, 2023 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DATAUNIRIO/b165644fe523029746748c0623186d5c to your computer and use it in GitHub Desktop.
Save DATAUNIRIO/b165644fe523029746748c0623186d5c to your computer and use it in GitHub Desktop.
bairros <- geojsonio::geojson_read("https://github.com/DATAUNIRIO/Mapas_e_Shapesfiles/raw/master/rio/Limite_de_Bairros.geojson", what = "sp")
class(bairros)
names(bairros)
library(leaflet)
m %>%
m = leaflet(bairros) %>%
addTiles() %>%
addProviderTiles('CartoDB.Positron')
m %>% addPolygons()
#--------------------------------------------------
bins <- c(0, 10, 20, 50, 100, 200, 500, 1000, Inf)
pal <- colorBin("YlOrRd", domain = bairros@data[["codbnum"]], bins = bins)
m1 = leaflet(bairros) %>%
addTiles() %>% addProviderTiles('Esri.WorldImagery')
m1 %>%
addPolygons(
fillColor = ~pal(bairros@data[["codbnum"]]),
weight = 2,
color = "white")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment