Aldemar A. Acevedo
31 de octubre de 2017
¿Cómo fusionar la información y hacerla interactiva?
leaflet:
Permite crear y personalizar mapas interactivos usando la biblioteca de JavaScript 'Leaflet' y el paquete 'htmlwidgets'.
Estos mapas se pueden usar directamente desde la consola R, desde 'RStudio', en aplicaciones Shiny y en documentos R Markdown.
Anfi2 <- read_csv("https://xxxxxxxxxxxxxx26/Anfibios2.csv")
saveRDS(Anfi2, "Anfi2.rds")
Anfi2 <- readRDS("Anfi2.rds")
Los mapas abierto para R se pueden encontrar en la siguiente dirección: Leaflet-providers.
Parques <-
geojsonio::geojson_read("https://xxxxxxx/PAS5.json", what = "sp")
leaflet(data = Anfi2) %>% addProviderTiles("Stamen.Terrain") %>% addPolygons(data = Parques, popup=Parques$NOMBRE)%>% setView(-72, 6, zoom = 6)
%>% addCircleMarkers(~longitude, ~latitude, popup = paste("Species:", Anfi2$name,"<br>","Red List Status:", Anfi2$Categoria, "<br>","Land cover:",Anfi2$Coberturavegetal, "<br>", "PAs:", Anfi2$Area, "<br>", "Date established as PA:", Anfi2$Aode.creacion, "<br>","IUCN protected area category:", Anfi2$CaIUCN, "<br>", "YOD-LYO:", Anfi2$YearD, "-", Anfi2$YearL, "<br>")
pal1 <- colorFactor(heat.colors(3), Anfi2$Categoria)
label = ~as.character(name), fillOpacity = 0.5, radius = 7, weight=15, fillColor = "black", color = ~pal1(Categoria), group = ~Categoria) %>% addLayersControl(
overlayGroups = ~Categoria, c("CR","EN","VU"),
options = layersControlOptions(collapsed = FALSE))
Anfi2 <- read_csv("https://xxxxxxxxxxxxxx26/Anfibios2.csv")
saveRDS(Anfi2, "Anfi2.rds")
Anfi2 <- readRDS("Anfi2.rds")
Parques <- geojsonio::geojson_read("https://xxxxxx/PAS5.json", what = "sp")
pal1 <- colorFactor(heat.colors(3), Anfi2$Categoria)
leaflet(data = Anfi2) %>% addProviderTiles("Stamen.Terrain") %>% addPolygons(data = Parques, popup=Parques$NOMBRE)%>% setView(-72, 6, zoom = 6) %>% addCircleMarkers(~longitude, ~latitude, popup = paste("Species:", Anfi2$name,"<br>","Red List Status:", Anfi2$Categoria, "<br>","Land cover:",Anfi2$Coberturavegetal, "<br>", "PAs:", Anfi2$Area, "<br>", "Date established as PA:", Anfi2$Aode.creacion, "<br>","IUCN protected area category:", Anfi2$CaIUCN, "<br>", "YOD-LYO:", Anfi2$YearD, "-", Anfi2$YearL, "<br>"), label = ~as.character(name), fillOpacity = 0.5, radius = 7, weight=15, fillColor = "black", color = ~pal1(Categoria), group = ~Categoria) %>% addLayersControl(
overlayGroups = ~Categoria, c("CR","EN","VU"),
options = layersControlOptions(collapsed = FALSE))
http://rpubs.com/bioaldemar/amphibians_Colombia