gadm.extract | R Documentation |
Extract one or more levels of administrative unit geometries from the GADM database in GeoPackage format
gadm.extract(input, output, countries = NULL, level = 0:5, ...)
input |
GeoPackage file to read from |
output |
name of file to save output to |
countries |
country or countries to limit results to, if |
level |
level(s) of administrative units 0:5 to extract; note not all levels are defined for all countries |
... |
additional arguments passed to |
This function is designed to extract subsets of the
Database of Global Administrative Areas (GADM). It uses
the version of the database in GeoPackage format that provides one layer for
each level of administrative division, available at
https://gadm.org/download_world.html.
The current version of this file is gadm36_levels.gpkg
. It is intended
for programmatic and reproducible subsetting of the database without
requiring the user to individually download specific country data files.
## Not run: ## extract gadm.extract("gadm36_levels.gpkg", "Nordics.gpkg", c("Denmark", "Finland", "Iceland", "Norway", "Sweden"), level = 0:2) ## add layers 3 and 4, use delete_layer = TRUE to rewrite existing layers gadm.extract("gadm36_levels.gpkg", "Nordics.gpkg", c("Denmark", "Finland", "Iceland", "Norway", "Sweden"), level = 0:4, delete_layer = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.