get_shapes: Download a shapefile from GADM

View source: R/get_shapes.R

get_shapesR Documentation

Download a shapefile from GADM

Description

we need a bit more explanation here ... The function works with both versions 3.6 and 4.0, 4.1 of the GADM library

Usage

get_shapes(url, level = 0)

Arguments

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)

Examples

# 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()

Stat585-at-ISU/worldle documentation built on April 4, 2023, 5:45 a.m.