Learn R Programming

Rnightlights (version 0.2.4)

readCtryPolyAdmLayer: Read a country admLevel polygon

Description

Read a country admLevel polygon. Reads the saved RDS format of the shapefile which is saved as part of dnldCtryPoly by default. Otherwise, it will try to read the shapefile. If it fails it returns null.

Usage

readCtryPolyAdmLayer(ctryCode = NULL, admLevel, polyType = "rds",
  dnldPoly = TRUE, gadmVersion = pkgOptions("gadmVersion"),
  gadmPolyType = pkgOptions("gadmPolyType"), custPolyPath = NULL)

Arguments

ctryCode

character The ctryCode of the country of interest

admLevel

character The name to search for

polyType

character Whether to read the shapefile or the RDS format.

dnldPoly

logical If the country polygon doesn't exist should we download it?

gadmVersion

The GADM version to use

gadmPolyType

The format of polygons to download from GADM

custPolyPath

Alternative to GADM. A path to a custom shapefile zip

Value

SpatialPolygonsDataFrame The admLevel polygon layer or NULL if not found

Examples

Run this code
# NOT RUN {
readCtryPolyAdmLayer("KEN", "KEN_adm1")
#returns "KEN_adm1"
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab