getShp: Download MAPadmin2013 Administrative Boundary Shapefiles from...

Description Usage Arguments Value See Also Examples

View source: R/getShp.R

Description

getShp downloads a shapefile for a specified country (or countries) and returns this as either a spatialPolygon or data.frame object.

Usage

1
2
3
4
5
6
7
8
9
getShp(
  country = NULL,
  ISO = NULL,
  extent = NULL,
  admin_level = c("admin0"),
  format = "spatialpolygon",
  long = NULL,
  lat = NULL
)

Arguments

country

string containing name of desired country, e.g. c("Country1", "Country2", ...) OR = "ALL" (use either ISO OR country)

ISO

string containing ISO3 code for desired country, e.g. c("XXX", "YYY", ...) OR = "ALL" (use either ISO OR country)

extent

2x2 matrix specifying the spatial extent within which polygons are desired, as returned by sp::bbox() - the first column has the minimum, the second the maximum values; rows 1 & 2 represent the x & y dimensions respectively (matrix(c("xmin", "ymin","xmax", "ymax"), nrow = 2, ncol = 2, dimnames = list(c("x", "y"), c("min", "max")))). Note: getShp downloads the entire polygon for any polygons falling within the extent.

admin_level

string specifying the administrative level for which shapefile are desired (only "admin0","admin1","admin2","admin3", or "all" accepted). N.B. Not all administrative levels are available for all countries. Use listShp to check which shapefiles are available. If an administrative level is requested that is not available, the closest available administrative level shapefiles will be returned.

format

string specifying the desired format for the downloaded shapefile: either "spatialpolygon" or "df"

long

longitude of a point location falling within the desired shapefile.

lat

latitude of a point location falling within the desired shapefile.

Value

getShp returns either a dataframe or spatialPolygon object for requested administrative unit polygons. The following attribute fields are included:

  1. id unique identifier for any given polygon/administrative unit.

  2. iso ISO-3 code of given administrative unit (or the ISO code of parent unit for administrative-level 1 units).

  3. admn_level administrative level of the given administrative unit - either 0 (national), 1 (first-level division), 2 (second-level division), 3 (third-level division).

  4. name_0 name of admin0 parent of a given administrative unit (or just shapefile name for admin0 units)

  5. id_0 id code of admin0 parent of the current shapefile (or just shapefile id for admin0 units)

  6. type_0 if applicable, type of administrative unit or admin0 parent

  7. name_1 name of admin1 parent of a given administrative unit (or just shapefile name for admin1 units); NA for admin0 units

  8. id_1 id code of admin1 parent of the current shapefile (or just shapefile id for admin1 units); NA for admin0 units

  9. type_1 if applicable, type of administrative unit or admin1 parent

  10. name_2 name of admin2 parent of a given administrative unit (or just shapefile name for admin2 units); NA for admin0, admin1 units

  11. id_2 id code of admin2 parent of the current shapefile (or just shapefile id for admin2 units); NA for admin0, admin1 units

  12. type_2 if applicable, type of administrative unit or admin2 parent

  13. name_3 name of admin3 parent of a given administrative unit (or just shapefile name for admin3 units); NA for admin0, admin1, admin2 units

  14. id_3 id code of admin3 parent of the current shapefile (or just shapefile id for admin3 units); NA for admin0, admin1, admin2 units

  15. type_3 if applicable, type of administrative unit

  16. source source of administrative boundaries

  17. country_level composite iso_admn_level field.

See Also

autoplot method for quick mapping of PR point locations (autoplot.pr.points).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#Download PfPR data & associated shapefiles for Nigeria and Cameroon

NGA_CMR_PR <- getPR(country = c("Nigeria", "Cameroon"), species = "Pf")
NGA_CMR_shp <- getShp(country = c("Nigeria", "Cameroon"))

#Download PfPR data & associated shapefiles for Chad
Chad_PR <- getPR(ISO = "TCD", species = "both")
Chad_shp <- getShp(ISO = "TCD")

#' #Download PfPR data & associated shapefiles defined by extent for Madagascar
MDG_PR <- getPR(country = "Madagascar", species = "Pv")

malariaAtlas documentation built on July 8, 2020, 5:46 p.m.