get_shapes | R Documentation |
we need a bit more explanation here ... The function works with both versions 3.6 and 4.0, 4.1 of the GADM library
get_shapes(url, level = 0)
url |
address to zipped file shapes |
level |
which level to extract? 0 is country outline, 1 is state/territories, for some (but not all) countries exist lower-level country divisions (e.g. counties, municipalities) |
# url for Iran
url <- 'https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_IRN_shp.zip'
# url for Bahamas
url <- "https://geodata.ucdavis.edu/gadm/gadm4.1/shp/gadm41_BHS_shp.zip"
country <- get_shapes(url)
url <- "https://geodata.ucdavis.edu/gadm/gadm4.0/shp/gadm40_BHS_shp.zip"
library(ggplot2)
library(dplyr)
country %>% thin(tolerance=0.001) %>% ggplot() + geom_sf() + theme_void()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.