getShp | R Documentation |
getShp
downloads a shapefile for a specified country (or countries) and returns this as either a spatialPolygon or data.frame object.
getShp(
country = NULL,
ISO = NULL,
extent = NULL,
admin_level = c("admin0"),
format = NULL,
long = NULL,
lat = NULL,
version = NULL
)
country |
string containing name of desired country, e.g. |
ISO |
string containing ISO3 code for desired country, e.g. |
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")))). |
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 |
deprecated argument. Please remove it from your code. |
long |
longitude of a point location falling within the desired shapefile. |
lat |
latitude of a point location falling within the desired shapefile. |
version |
The admin unit dataset version to return. Is NULL by default, and if left NULL will just use the most recent version of admin unit data. |
getShp
returns a sf object for requested administrative unit polygons. The following attribute fields are included:
iso
ISO-3 code of given administrative unit (or the ISO code of parent unit for administrative-level 1 units).
admn_level
administrative level of the given administrative unit - either 0 (national), 1 (first-level division), 2 (second-level division), 3 (third-level division).
name_0
name of admin0 parent of a given administrative unit (or just shapefile name for admin0 units)
id_0
id code of admin0 parent of the current shapefile (or just shapefile id for admin0 units)
type_0
if applicable, type of administrative unit or admin0 parent
name_1
name of admin1 parent of a given administrative unit (or just shapefile name for admin1 units); NA for admin0 units
id_1
id code of admin1 parent of the current shapefile (or just shapefile id for admin1 units); NA for admin0 units
type_1
if applicable, type of administrative unit or admin1 parent
name_2
name of admin2 parent of a given administrative unit (or just shapefile name for admin2 units); NA for admin0, admin1 units
id_2
id code of admin2 parent of the current shapefile (or just shapefile id for admin2 units); NA for admin0, admin1 units
type_2
if applicable, type of administrative unit or admin2 parent
name_3
name of admin3 parent of a given administrative unit (or just shapefile name for admin3 units); NA for admin0, admin1, admin2 units
id_3
id code of admin3 parent of the current shapefile (or just shapefile id for admin3 units); NA for admin0, admin1, admin2 units
type_3
if applicable, type of administrative unit
source
source of administrative boundaries
geometry
geometry of administrative boundaries
country_level
composite iso
_admn_level
field.
autoplot
method for quick mapping of PR point locations (autoplot.pr.points
).
#Download PfPR data & associated shapefiles for Nigeria and Cameroon
## Not run:
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")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.