Skip to contents

This function takes a single ISO country code and downloads the corresponding high resolution administrative boundary GeoJSON files from the www.geoBoundaries.org API hosted at GitHub HERE. If the desired administrative level is not available the next most detailed administrative level is returned.

Usage

download_admin_data(
  iso3,
  release,
  path_output,
  simplified = FALSE,
  keep_geojson = FALSE
)

Arguments

iso3

A three-letter capitalized character string. Must follow the ISO-3166 Alpha-3 country code

release

A character string specifying the release type on the geoBoundaries API. It should be one of 'gbOpen', 'gbHumanitarian', or 'gbAuthoritative'. Release types are described at https://www.geoboundaries.org/api.html#api.

path_output

A character string giving the file path of an output directory to save downloaded data.

simplified

Logical indicating whether to download simplified administrative boundaries instead of high resolution. Default is FALSE.

keep_geojson

Logical indicating whether to keep the raw geojson files downloaded from geoBoundaries API. Default is FALSE.

Value

Character string giving path to downloaded data.

Examples

if (FALSE) {

download_admin_data(iso3 = 'MCO',
                    release = 'gbOpen',
                    path_output = tempdir())
}